Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll to row programatically with virtual paging/infinite scrolling. #1237

Closed
LuisPalacios opened this issue Nov 3, 2016 · 6 comments
Closed

Comments

@LuisPalacios
Copy link

Hi, I've tried api.selectNode(node, true) mentioned in #381 and ensureIndexVisible(index) in #907, however I'm using virtual paging / infinite scrolling with i.e. paginationPageSize: 100.

So, when I get the data modified and issue a setDatasource(mydatasource) so my table gets refreshed it inmediately positions into its first page (0-99) and trying i.e. ensureIndexVisible(1000) returns an error.

Is there a way to, programatically, jump to a specific page (offset) or scroll to any row (I guess triggering a new request for an specific page) ?

Thanks a lot for your help in advance,
Luis

@ceolter
Copy link
Contributor

ceolter commented Nov 7, 2016

go to here:
https://www.ag-grid.com/javascript-grid-virtual-paging/
look at last example, the button 'jump to 500' shows jumping to row 500

@ceolter ceolter closed this as completed Nov 7, 2016
@laps1967
Copy link

how can you show the row as selected after you jump to the row

@jml3on
Copy link

jml3on commented Jun 15, 2017

I'm having trouble selecting the row after ensuring it's visible.

use case: large virtual table, double click jumps to the details page for that row. When user navigates back, to the list I want to table to show where they were.

ensureIndexVisible properly restores the table with the row showing, but now, I want that row to be selected.

GridApi.selectIndex prints a warning telling me to use node.setSelected:
ag-Grid: do not use api for selection, call node.setSelected(value) instead

but right after calling ensureIndexVisible, I don't have that node.

So I've hooked up into the onModelUpdated events and do a foreachNode until I find my node and can select it. while this works, ag-grid prints a warning that :
ag-grid-enterprise.js:10806 ag-Grid: cannot select node until id for node is known

But this seems fragile and overly complicated.

any suggestion?

Tx.

@Chris55
Copy link

Chris55 commented Apr 2, 2021

hi @jml3on

4 years later I'm trying to do the same thing... wondering where you able to find a more robust solution?

@jml3on
Copy link

jml3on commented Apr 3, 2021

nope. but it looks like closed issues never get looked at, so you should probably open a new one.

@Chris55
Copy link

Chris55 commented Apr 4, 2021

my workaround , starting point was the same 'jump to 500' official example.
https://stackoverflow.com/questions/66920395/how-to-select-a-row-on-ag-grid-in-infinite-row-mode

I'm using the community version with Infinite model, I guess will never have an answer here from ag-grid. but I guess quite similar to the server-end model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants