Hi,
I have a list feed by a store from a local json.
I wanna know how to remove an entry from my store. Because it is feed by a json file, does it will update the json ? and once the json is update how to refresh/synchronize my list ?
Same question for adding one entry, in the json file, then refreshing the list.
Here is the source code i am using for creating the store :
Code:
// -----------------------------------------
// ----- Create a live profile's store -----
// -----------------------------------------
Ext.define('LiveProfileModel',
{
extend: 'Ext.data.Model',
config:
{
fields:
[
{ name: 'id', type: 'int' },
{ name: 'name', type: 'string' },
{ name: 'delay', type: 'int' }
]
}
});
LiveProfileStore = Ext.create('Ext.data.Store', { model: 'LiveProfileModel' });
LiveProfileStore.setData(dmngConfig.liveProfile);
And the code need for the list :
Code:
{
title: 'LstLive',
layout: 'vbox',
padding: 10,
items:
[
{
title: _strings_live_liveprofilelisting[dmngConfig.deviceLanguageID],
xtype: 'list',
itemTpl: '{name} (delay:{delay})',
store: LiveProfileStore,
listeners:
{
itemtap: function(record, index)
{
//console.log("record="+record+" - index="+index);
//console.log(record);
console.log("[LIVE] id=" + dmngConfig.liveProfile[index].id);
console.log("[LIVE] name=" + dmngConfig.liveProfile[index].name);
console.log("[LIVE] delay=" + dmngConfig.liveProfile[index].delay);
localStorage['liveprofileid'] = dmngConfig.liveProfile[index].id;
localStorage['liveprofilename'] = dmngConfig.liveProfile[index].name;
localStorage['liveprofiledelay'] = dmngConfig.liveProfile[index].delay;
liveview.push(2);
}
}
}
]
}
Thanks in advance.
Regards