Hi,
Is it possible to scroll igGrid to specific row by JavaScript ?
Thanks,
Ed
1. No, I mean $("#grid1_scroll"). That's the ID of the scroll container. The grid has it so that it can show scrollbars and render complex layouts
2. This isn't part of the igGrid API, it's part of jQuery:
http://api.jquery.com/find/
3. yes
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 ?
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,