PDA

View Full Version : tabpanel hidden tabs values



manojo
16 May 2008, 12:51 AM
Hello,

I have a tabPanel in a FormPanel, and the tabpanel has 3 tabs.

When I post the form and view the POST object, only the values in tabs I have already seen appear.

For example if I have tab1, tab2, text1 in tab1, text2 in tab2, if I have not viewed tab2, in the POST object, I don't get a mapping for text2. But when I view the tab, I at least get an empty mapping.

What can I do in order to get the non-rendered fields to be mapped to POST ?

Thanks,
Manojo

16 May 2008, 4:25 AM
you have two options:
1) turn off lazy rendering, which slows down the component init
2) setup your own collection method(s).

manojo
20 May 2008, 4:38 AM
Hi,

by adding

deferredRender: false

to my panel, I get an NS_ERROR_NOT_AVAILABLE error.
My panel is not rendered directly, it is inside a formPanel. Does this make a difference ?

As for option 2, I don't have too much time to code it right now :(

Thanks,
Manojo

20 May 2008, 4:53 AM
it's simpler than you think:


var list = [];
Ext.each(yourForm.items.items, function(item, index, allItems) {
list.push(item.getValue();

});

// insert ajax.request

jcwatson11
20 May 2008, 11:46 AM
Hello,

I solved this problem without realizing it by using an activerecord-style data connection. If the key-value pair isn't submitted in the form, activerecord presumes it isn't changing and the data value stays the same.

The problem I am having however is on the other end of this scenario. When I use form.load() to load data into a form with 3 tabpanels, only the data for the active tab is loaded. How can I have the data loaded into the fields that haven't been rendered yet? I tried setting lazyRender:false on the textfields but I'm guessing that's the wrong place to set it because it didn't make any difference. Any ideas?

20 May 2008, 11:48 AM
the data should be loaded for the fields that have not rendered. try accessing anyField.getValue(), where anyField is not rendered. you should get the data.

jcwatson11
20 May 2008, 1:19 PM
For now I ended up using the value config property field to pre-load the values because I have a deadline today. But I will get back to you on that. Thanks for the help!

manojo
21 May 2008, 12:10 PM
Hi jgarcia,

so the method you provided loads all data into a list. So this means I need to remember the exact order in which they are in the form ? Can I use form.submit without specifying params with this ?
I also have fields in my form from which I cannot simply do getValue() : I have two grids with which I do a grid.getSelectionModel().getSelections().
How do I include this ?

Thanks,
Manojo

21 May 2008, 12:20 PM
No you don't need to remember the order. It's irrelevant. Once you get the aggregate data, append the datagrid record set to the properties and fire it off as parameters.

form.submit will not submit data from non rendered objects. What you're looking to do is really not difficult.