Hi,
Is it possible to scroll igGrid to specific row by JavaScript ?
Thanks,
Ed
yes it is possible. I hope this snippet works for you:
$("#grid1_scroll").scrollTop($("#grid1").find("tr > td:contains('323')").first().position().top);
it will scroll to the row where the first TD text has "323" in it. Similarly, you can use other selectors. if you have primaryKey set in the grid, it is even more straightforward:
$("#grid1_scroll").scrollTop($("#grid1").find("tr[data-id='<primary key value>']").first().position().top);
We plan to add this to the grid API in the future. Hope it helps. Thanks,
Angel
Angel,
Thanks for the answer. I have additional questions:
1. Do you mean $("#grid1").igGrid("scrollContainer") instead of $("#grid1_scroll") ?
2. I don't see igGrid find() method in docs. Is it undocumented ?
3. I can use $("#grid1").igGrid("findRecordByKey", "key value") in second case, correct ?
Another question - will this feature be added to next release ?
Hello ,
how about scrolling with Visualization feature ( https://www.igniteui.com/grid/virtualization-continuous )
with virtualization, table only render 1,000 records . so the "find("tr[data-id='<primary key value>']").first().position().top" will not work if data list have more than 1000 rows .
we used find index and re-calculated by index * row height , but when user use sort , the index in grid was changed
No, I did not solve this. As far as I know, person who continued this pilot project switched it to IBM Worklight and Sencha Touch.
Thanks
Hello,
I too am very interested in this functionality. Is there a way to do it?
Alex
Have you solved this?
It would be really nice if the $('#grid1').igGridSelection('selectRow', i) would automatically scroll the new selected row into the visible area.
Thanks, scrolling does work! However how can I find that specific record is outside the visible part of the grid and I really need to scroll the grid to select it ? If the record is visible, I can just select it, something like:
$('#grid1').igGridSelection('selectRow', i);
Now when I scroll to the visible record, grid first scrolls to it and the record became top record of the visible grid, then it scrolls back, record jumps to the previous place and became selected.