PDA

View Full Version : Partial update of the store which is powering a grid panel.



sumit_bnglr
6 Oct 2012, 7:39 AM
Hi All,

I need urgent help in figuring out a way to partial update the store. I've a grid panel which uses a grid. On a normal case the grid might have 2000 rows, and I want to update only some of them at a regular interval (depending on that particular row's status).

Is there a way to do any of the following:
1. Load the full store initially, then add some filters to load partially while keeping the initial rows intact.
2. Create a new small store and update the main store.
3. Any other more suitable way?


Thanks,
Sumit

scottmartin
6 Oct 2012, 9:26 AM
What is the criteria for updating the records? I would suggest performing this at the server and then send the updated record back to the grid in the interval.

This would be much faster and you already have the means at the server to do what you need.

Scott.

sumit_bnglr
6 Oct 2012, 10:06 AM
Hi Scott,

Thanks for the reply. Though I am still not getting the server side processing to solve this. For better understanding here is the complete scenario:

When a user logged in he or she will see a Extjs UI, which is being supported by a Rails backend. The initial loading loads a grid with set of tasks, and I want to refresh a certain set of tasks only which did not finished yet. So my criterion of refresh is task's status.

Also there may be multiple users, viewing diff collections (each one having 1000+ diff tasks) simultaneously.

Thanks,
Sumit

scottmartin
6 Oct 2012, 1:05 PM
Then issue a ajax request sending the userid and update the tasks accordingly, then send the new result set to the client. This way the data is accurate and the client is not ahead of the server.

The client should reflect the data.

You mention 2000 records ... how are you displaying the data, all at once in a buffered grid, or paging?

The user can only see a finite set of records at once .. so sending back the active page should be very quick to update.

The alternative is to loop through the store and update the records based on your criteria at the client .. will the server reflect these changes?

Scott.

sumit_bnglr
7 Oct 2012, 7:24 AM
Do you want me to send the whole set of collection every time ?

For better understanding, the backend supports following apis:

get '/collection/123/tasks'  => send all tasks in the collection (assume 2k)

get '/collection/123/tasks?status=RUNNING'  => send small set of tasks (assume 100)

get '/tasks/4567'  => send info about only a single task.

So here is what I want to achieve.

In the first loading get all the tasks belongs to a collection and show them in a scrollable grid.
After every 5mins refresh the running tasks. While keeping the same number of grid rows, i.e. update only subset of tasks.

scottmartin
7 Oct 2012, 8:42 AM
Do you want me to send the whole set of collection every time ?

No.

In not knowing how you are displaying the data, I have to make suggestions.

Take the instance of using a grid with pagination ... 25 records visible per page.

You have 2000 records. You need to update 200 records of status update.
Every 5 min. you update the status at the server. All 200 records are updated.
Only 25 records are sent back for the page you are on to update active display.

When you paginate, the new records from the server are already updated and sent back when you change pages.

If you are using a buffered grid only a subset if load. If you update on the client level, how are you going to ensure that some of the records that need to be updated on loaded into the buffer?

If you update at the client level, you then have to update again at the server to sync and then if you have records that were not loaded in the buffer, when are they updated?

Make sense?

Scott.

sumit_bnglr
15 Oct 2012, 1:57 AM
Finally I settled with 25 records per page pagination and updating those in every 5 mins.

Thanks for the help Scott.