PDA

View Full Version : [CLOSED] Form Initialization in 2.x not woking



ndotis
Dec 28, 2013, 12:54 AM
Hello

The below code to initiaze the form works fine in 1.x bit not in 2.x version.



var initFields = function(form) {
form.getForm().items.each(function(f) {
if (f.isFormField || f.isDirty()) {
f.originalValue = f.getValue();
}
}
);


Advise..

geoffrey.mcgill
Dec 28, 2013, 11:57 PM
When you stepped through the code, where did it fail?

I believe .isFormField was removed in Ext JS 4, so that might be the problem.

ndotis
Dec 30, 2013, 6:19 PM
well,

form.getForm().items is not valid.
it should be

form.getForm().getFields().items.forEach

here is the complete working code


var initFields = function(form) {
form.getForm().getFields().items.forEach(function( f) {
if (f.isFormField || f.isDirty()) {
f.originalValue = f.getValue();
}
});
}

Baidaly
Dec 30, 2013, 8:57 PM
Hello!

Can you clarify, did you solve this problem?

ndotis
Dec 30, 2013, 9:27 PM
Hello!

Can you clarify, did you solve this problem?

Yes, problem is solved, please close the request.