PDA

View Full Version : Store load twice



Sinapit
3 Apr 2014, 3:29 AM
Hi everyone,

I have controller and add load store dynamic in it but store load twice, one from my store dynamic (this.getGrids().store.load) and last from store class (setting.usergroupaccess)



Ext.define('sf6cola.controller.setting.usergroupaccess', {
extend: 'Ext.app.Controller',
refs: [
{ref: 'panelss', selector: 'usergroupaccess'},
{ref: 'grids', selector: 'usergroupaccess grid[name=usergroupaccess_grid]'}
],
views: [
'setting.usergroupaccess'
],
models: [
'setting.usergroupaccess'
],
stores: [
'setting.usergroupaccess',
'util.statuscg'
],
init: function () {
this.control({
'usergroupaccess grid[name=usergroupaccess_grid]': {
load: this.loadData,
render: this.loadData
},
'usergroupaccess button[action=refreshAccessButton]': {
click: this.loadData
}
});
},
loadData: function()
{
this.getGrids().store.load({
params:{
group:this.getPanelss().title.split(':')[1].trim(),
start: 0, limit: 10
},
scope: this,
callback: function(records, operation, success) {
console.log('records');
}
});
}
});


48538

Anyone can help me where's my code. Thank you

3xc3ption
3 Apr 2014, 4:06 AM
Hey,

please take a look in your store config!


autoLoad: false

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store

Zinnia
3 Apr 2014, 4:23 AM
Why are you calling loadData() twice

load: this.loadData,
render: this.loadData

Sinapit
3 Apr 2014, 6:08 AM
huft....your right, cause it my store loaded twice,i've use one of it and store loaded one. thank's for your correction ~o)