Reputation: 203
I have a grid with one column 'name' which is empty in the start. I also have a JSONObject within which there is an array of fields. I now need to add each field name as a row in the grid dynamically (since the JSONObject I am receiving via REST services). Please advice as to how do I do that.
I wish to know how to add to an empty store dynamically which finally is reflected even after the page is loaded.
e.g.:
datajson: {
...
events: {
'First row' : {
...
}, {
'Second row' : {
...
}
}
}
So now the grid must contain 'First row' and 'Second row' as the two entries.
Upvotes: 2
Views: 5263
Reputation: 900
bind a store to your grid
{
xtype: 'grid',
store: myStore
}
then update your store with data
myStore.loadData(jsonData)
after you can refresh the grid with:
myStore.getView().refresh();
Upvotes: 3