ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Loading Grid with Initial selected row
Title:
B
I
{code}
?
After editing an record in an other mvc page I come back to my overview page, witch I would select the editing record in my overview grid. How can I do that? The grid has paging and is bind to EF with GridModelBuilder
Save Changes
Cancel
Alessandro
asked at 09 Oct 2019
Answers
B
I
{code}
?
If the row is on the first page you could simply find it and add `awe-selected` class to it, example: $(function(){ // on first aweload only $('#Grid1').one('aweload', function(){ $('#Grid1').data('api').select(id)[0].addClass('awe-selected'); }); }); Now if the record is not on the first page there's various things you could do, like sorting the grid in a way that the row would be on the first page or going to the last page, and only after run the selection script. Note, grid `api.load` returns a promise so you can use `$.when` to execute js after the load has completed, example: $.when($('#ApiDemoGrid').data('api').load()).done(function(){ console.log('hi'); });
Save Changes
Cancel
Omu
answered at 09 Oct 2019
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK