PDA

View Full Version : Getting all items from form or panel



himansu.sekhar.swain
17 Sep 2013, 5:48 AM
Hi, I am new to extjs 3.4. I have a form with multiple tab panels in which there are multiple items like (dropdown, multi-select, radio etc..) are there. And each multi-select has associated with their own search field. I want to get all these items except search fields and form an array. I have used following code but it gives me only enabled fields, if any fields are in disabled state i am not getting those in array. Your help will be highly appreciated. Thanks in advance,
Code:
getValues: function() {
var i, len, field, values = {}, items = this.getComponent('tabpanel').items, component;
for (i=0, len=items.getCount(); i<len; i++) {
component = items.itemAt(i);
if (component.isXType('form')){
Ext.apply(values, component.getForm().getValues());
}
}
return values;
},

slemmon
20 Sep 2013, 8:59 AM
You might see if you can glean any insights by setting a debugger before your getValues() statement and trace how the form is searched to retrieve the form values (using Ext.lib.Ajax.serializeForm(form)) and create your own modified script to walk the form and read from all fields including those that are disabled.

himansu.sekhar.swain
22 Sep 2013, 9:06 PM
Hi Slemmon, Thanks a lot. I have tried using getForm().items, it gives me a mixed collextion from which I am getting all types of field in the form. But the small pain is : I have to write some array logic to get and form the required array. Whatever you have explained, could you please show me some sample implementation (Code).