Monday, June 27, 2011

Extjs Store FAQs

While using Extjs store you will come across some common questions like how to reload a store or change its url etc.

Below is the listing of some of the extjs store FAQs and their answers.

Change store url dynamically :
store.proxy.url = newUrl;

Update or add store baseparams
store.baseParams = {
    sort : "name",
    selectedUser : store.getById(userId).data.userName
store.baseParams.selectedUser :  store.getById("10").data.userName;

Load store from another store
//to load store with json data use store1.reader.jsonData

Reload the store :

Load store with the value stored in local (javascript) variable :
// localVariable contains the data to be loaded into the store.

Append data to existing store :
store.loadData(newData, true) //newData contains the data to be appended

Iterate over store records :
store.each(function(currentRecord) {
    // alerts record id for each store record

Remove a record from the store :
//recordToRemove is the record object to be removed from store.
//This can also be an array if you want to remove multiple records.
//Use store.removeAll() to remove all the records
//If you know index of the record then use store.removeAt(recordIndex)


  1. how do you get the associated view to update after doing loadData() on a store?

  2. Really very good post.....we look around in net for more than 1 week for json store reload issue....its helped us...

    thanks a lot