PDA

View Full Version : Immitation button click after store load



velocat
23 Apr 2014, 10:56 AM
Pls, help me ))
I can not add an event simulating a click



var chart = new Ext.Panel({
height:200,
layout:'fit',
margins: '5 5 0',
region:'north',
split: true,
minHeight: 100,
maxHeight: 500,
title: LANG['chart_panel'],
collapsible: true,
iconCls: 'icon-chart',
bbar: ['<b>See: </b>','-',{
text: 'All',
id: 'btnall',
handler: function(){
Gstore.clearFilter('year');
cstore.refreshData();
}
}]});



userGrid.store.on('load', Ext.get('btnall').click, userGrid);
Cannot read property 'click' of null

skirtle
23 Apr 2014, 12:06 PM
Trying to force the event is the wrong way to do this. Move the relevant logic to a method then call the method from both the handler and the load callback.

velocat
24 Apr 2014, 6:22 AM
Solved the problem by adding a listener to the Store:




listeners: {
load: {
fn: function ( {
Gstore.clearFilter('year');
cstore.refreshData();
}
}
}