View Full Version : Question regarding Grid Row Selection with Paging

19 Mar 2012, 11:56 AM
Hi there,

I'm sure this question has been answered before so I'm sorry if this is a duplicate.

Currently I have the following...

1) testGrid which is defined with the store "testStore"

2) testStore which is using paging (aka pageSize) so that every 5 grid rows there will be a new page created

3) testStore which is also using an ajax request to retrieve and load 5 records at a time from a database so they are displayed in the grid

However, when I want to save a new record into the database from the application, I have performed an ajax request which saves to the database where inside the "success" return of the ajax I was looking to do the following...

success: function()
//Required since store load is an asynchronous call?
//Retrieve the index of the newly created record
store.findExact('testFieldName', 'newRecordName');

//Retrieve the page number based on the index of the newly created record

//Load the specific page which is where the newly created record is located
//Is store.loadPage() an ansynchronous call?

//Select the newly created record once the page is loaded

Although of course, (store.findExact) is not going to work (aka -1 or undefined) since if the newly created record is on say page 4 only page 1 is initially being loaded and I can't statically just load page 4 since any new record is added dynamically so you never know what page a new record will be added to.

I would imagine that I could just create a 2nd store and retrieve all database results but that really doesn't seem effecient at all.

Any suggestions?

19 Mar 2012, 12:01 PM
There is a plugin that may be of help to you http://www.sencha.com/forum/showthread.php?163418-Ext.ux.grid.plugin.PagingSelectionPersistence