Hi
I have a store which take 5 second to load and I want to bind it to a grid after it finish loading
How can I do?
Thanks
Hi
I have a store which take 5 second to load and I want to bind it to a grid after it finish loading
How can I do?
Thanks
You can either load a store and use it to populate the store already bound to the grid, or use reconfigure to assign a new store.
Scott.
Thank you Scott
Could you please give me an example of this "You can either load a store and use it to populate the store already bound to the grid"?
Thank you
Review the following:
Scott.Code:// main app store var gridStore = new Ext.data.Store({ }); // loader store for new data; append records to main var loadStore = new Ext.data.Store({ listeners: { 'load': function(store, records, successful) { gridStore.loadData(records,true); // append records to main } });
Wow it's really good Scott. Thank you.
I have another question.
I have a grid with many records. When user inserts a new record I must reload all the grid to show the new record and it takes time. I think I can use your solution to append the new record into the old store and reload it. But I don't know how we can add the new record in the first position.
Furthermore, do you have any other solution for my problem? I saw the CRUD model, but I don't know if it helps for performance.
Merci beaucoup Scott![]()
You can use store.insert(0,record) .. the grid will update.. there is no need reload entire store.
Scott
Thank you Scott
Hi Scott,
I tried to do as your instruction
// main app storevar gridStore = new Ext.data.Store({}); // loader store for new data; append records to mainvar loadStore = new Ext.data.Store({ listeners: { 'load': function(store, records, successful) { gridStore.loadData(records,true); // append records to main }});
It's really good but I have one more question about the performance. The code above means that we will load data in to loadStore and when the loadStore finish loading we will put these data into gridStore. My problem is when loadStore is loading, if I do some otherrequest to server, the server cannot response immediately but it must wait for the loadStore to finishloading.Do you know how to improve the performance here?Thank you
You can use store.suspendEvents/resumeEvents
Scott.
I had a similar task. I'm submitting data that spits out results. I wanted to wait for the store to load and then switch to another tab in my application and select the first row, since that is bound to a form. Your idea to listen for the load event works perfectly!
I might just need to add code to make sure there is at least one record.
Thanks Scott. I wish this guy would have marked this as answered.
Code:listeners : { load : function() { individualResultsGrid.getSelectionModel().select(0); console.log('userStore load fired') } },