denkoo
10-19-2008, 02:11 AM
When you would running function over all field's form, you can use
myForm.items.each(myFunction(oField) {....});
but if you use column or fieldset or tabpannel... you must use another function that I don't find on extjs... (may be this function exist but I don't know, so I made it and sharing)
Ext.namespace("Ext.ux");
Ext.ux.eachDeep = function (oObj,fFn) {
if(oObj['items'] !== undefined
&& oObj['items']['each'] !== undefined
&& Ext.type(oObj['items']['each']) == 'function') {
oObj['items']['each'](function (oOb) {
Ext.ux.eachDeep(oOb, fFn);
});
}
if(oObj.isFormField) {
return fFn.call(oObj);
}
return false;
};
If you need to call this function,
/* call this function after ajax saving => isDirty return false */
Ext.ux.eachDeep(Ext.getCmp('myFom'), function () {
this.originalValue = this.getValue();
});
myForm.items.each(myFunction(oField) {....});
but if you use column or fieldset or tabpannel... you must use another function that I don't find on extjs... (may be this function exist but I don't know, so I made it and sharing)
Ext.namespace("Ext.ux");
Ext.ux.eachDeep = function (oObj,fFn) {
if(oObj['items'] !== undefined
&& oObj['items']['each'] !== undefined
&& Ext.type(oObj['items']['each']) == 'function') {
oObj['items']['each'](function (oOb) {
Ext.ux.eachDeep(oOb, fFn);
});
}
if(oObj.isFormField) {
return fFn.call(oObj);
}
return false;
};
If you need to call this function,
/* call this function after ajax saving => isDirty return false */
Ext.ux.eachDeep(Ext.getCmp('myFom'), function () {
this.originalValue = this.getValue();
});