Archive

Archive for May, 2012

ExtJS 4 – replace data in an existing Store

May 18th, 2012 No comments

In the previous post shows how you can take data from the Store object. Now we will show how you can replace them with new values. Suitable if you have a combo box that needs to change in the list depending on some conditions.

The data you want to store in the Store shall have the following structure:

myData = [ ["1", "val1"] , ["2","val2"] ]

Data storage can be done in the following way:

Ext.getCmp('fieldID').store.loadData(myData)

Where the “fieldID” id form element ID that is assigned a Store object.

Categories: JavaScript Tags: ,

ExtJS 4 – get data from the Store

May 18th, 2012 No comments

If you need to get data from the Store object, you can do the following:

var myData = Ext.pluck(storeObj.data.items, 'data');

The return value is a two-dimensional array of structures similar to the above:

// myData = [ ["1", "val1"] , ["2","val2"] ]
Categories: JavaScript Tags: ,