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
Hi Alexender,
The above code doesn't work for me.
I had written like this:
$("#tblLstUPs_scroll").scrollTop( $("#tblLstUPs").find("tr > td:contains('IN-173-52006')").first().position().top );
Is the above snippet is correct?
Please advise how to keep both the horizontal and vertical scrollbars visible from anywhere in the grid. Right now, my vertical bar is appearing on the document (outside the grid) and the horizontal scrollbar is appearing from within the grid at the bottom. As a result, if I want to scroll to the right, I have to first scroll down to the bottom and then I can access the horizontal scrollbar.
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 ?