PDA

View Full Version : Working with model and store



sencha.user
22 Jan 2013, 4:30 AM
Hi all,

Is there a way to stop loading controller when I click 'next page', 'last page', etc in pagingtoolbar?

Because I have a VIEW with 2 MODELS and 2 STORES. Paging toolbar (in same view) which is associated with model1 and store1 loads along with store2 and model2 which is associated with controller.

Thanks in advance!

existdissolve
22 Jan 2013, 10:48 AM
What do you mean by "stop loading controller"?

sencha.user
23 Jan 2013, 5:16 AM
I have a grid and pagingtoolbar for it. Grid operates with a button click which in on the controller, it works right by loading the right model and store. But 'next button', etc on pagingtoolbar loads both models and stores, I mentioned only one store (which is associated with grid).

Sorry if I am confusing, codes are all everywhere that I couldn't put it here.

I have 2 grids, one associated with model1 and store1, another grid (and pagingtoolbar) associated with store2 and model2. So pagingtoolbar's buttons loads both models and stores is the problem.

existdissolve
23 Jan 2013, 6:23 AM
I have a grid and pagingtoolbar for it. Grid operates with a button click which in on the controller, it works right by loading the right model and store. But 'next button', etc on pagingtoolbar loads both models and stores, I mentioned only one store (which is associated with grid).

Sorry if I am confusing, codes are all everywhere that I couldn't put it here.

I have 2 grids, one associated with model1 and store1, another grid (and pagingtoolbar) associated with store2 and model2. So pagingtoolbar's buttons loads both models and stores is the problem.

Can you post your grid and paging toolbar configs?

sencha.user
23 Jan 2013, 6:58 AM
Both grids works with a controller,

{
id: 'fieldgrid',
xtype: 'gridpanel',
height: 370,
width: 160,
store: 'store1',
x: 0,
y: 0,
columns: [{
xtype: 'gridcolumn',
width: 132,
dataIndex: 'colName',
text: 'Select'
}],
viewConfig: {
autoRender: true
}
}
})
}, {
x: 162,
y: 0,
id: 'gridid'
height: 340,
xtype: 'gridPanel', //plugin
store: 'store2',
viewConfig: {
autoRender: true
}
}, {
xtype: 'pagingtoolbar',
id: 'paging',
x: 162,
y: 340,
height: 30,
displayInfo: true,
store: 'store2'
}

existdissolve
23 Jan 2013, 9:34 AM
Can you post the relevant snippets from your controller?

sencha.user
24 Jan 2013, 3:03 AM
onFieldButtonClick: function (button, e, options) {
var selectionChecked = Ext.getCmp('fieldgrid').getSelectionModel().getSelection();//First grid's checkbox values
var arrayValues = [];
Ext.each(selectionChecked, function (rec, index) {
arrayValues.push(rec.get('colName'));
});
var secondGrid = Ext.ComponentQuery.query('gridPanel')[0];
secondGrid.getStore().reload({
params: {
param1: [arrayValues]
}
});
}