marcvdm
13 Aug 2011, 1:11 AM
Hello,
I have set up a MVC structure in Ext 4, with a form (called "headerformpanel") and a grid (with a store called "contactsstores"). The idea is that any field change in the form should refilter the store (something I achieved before without problems in Ext 3.3, without MVC).
At first things seem ok with this part of code in the init part of the controller:
this.control({
'headerformpanel field':{
change: this.onChange
}
});
and then, in the function definitions:
onChange: function(){
console.log('change');
}
This does what we can expect: every change in any form field is seen as ONE 'change' message in the console
However, if I do something more than a console log, ie. reloading the store like this:
onChange: function(){
console.log('change');
Ext.widget('contactsstore').load(function(records, operation, success) {
console.log('loaded records');
});
}
then something strange happens: I get one 'change' console message (as before), but the store loads TWICE (as I can see in Firebug), strangely enough followed by only ONE 'loaded records' message....
Adding more lines of code (other than console logs) to the same function results somethimes in even more reloadings of the store, making the whole setup virtually unusable.
Anybody an idea of what's going on here?
Many thanks in advance....
I have set up a MVC structure in Ext 4, with a form (called "headerformpanel") and a grid (with a store called "contactsstores"). The idea is that any field change in the form should refilter the store (something I achieved before without problems in Ext 3.3, without MVC).
At first things seem ok with this part of code in the init part of the controller:
this.control({
'headerformpanel field':{
change: this.onChange
}
});
and then, in the function definitions:
onChange: function(){
console.log('change');
}
This does what we can expect: every change in any form field is seen as ONE 'change' message in the console
However, if I do something more than a console log, ie. reloading the store like this:
onChange: function(){
console.log('change');
Ext.widget('contactsstore').load(function(records, operation, success) {
console.log('loaded records');
});
}
then something strange happens: I get one 'change' console message (as before), but the store loads TWICE (as I can see in Firebug), strangely enough followed by only ONE 'loaded records' message....
Adding more lines of code (other than console logs) to the same function results somethimes in even more reloadings of the store, making the whole setup virtually unusable.
Anybody an idea of what's going on here?
Many thanks in advance....