-
3 Feb 2009 1:58 AM #1
FieldSet CheckBoxToggle question
FieldSet CheckBoxToggle question
Hi all,
I've created a form with two fieldsets, one of which uses a checkBoxToggle to show/hide it. When first displayed, I am populating the fieldsets with data pulled from the server. The problem is that I need to be able to programmatically toggle the checkbox, depending on the data received from the server. I can programmatically collapse/expand the fieldset ok but the checkbox itself is not checked when I expand the fieldset - is there a way to do this?
Thanks.
-
3 Feb 2009 2:06 AM #2
Not an easy one. But i just implemented it. Maybe it will be part of the next release.
-
3 Feb 2009 2:10 AM #3
Oh dear, is there any workaround I can use in the meantime? Your reply suggests there may not be though...

-
3 Feb 2009 2:21 AM #4
Check your PMs. I just sent you the override.
-
24 Feb 2009 11:58 AM #5
Hi sven,
I'm just looking for a similar functionality. Actually I need to activate the checkboxToggle field if any of the fields within the fieldset is selected. Can you give me please some ideas how to implement it?
Thanks in advance for your support.
-
7 Mar 2009 7:46 PM #6
Hi, sven!
Please post this workaround here, i search for it too.
Thanks in advance.
-
12 May 2009 12:45 AM #7
Hello,
this old thread is corresponding to my problem. No workaround has be posted (or i don't find it)
I'm using a FieldSet with checkBoxToggle.
Can the checkbox be checked when the fieldset is expanded ??
I'm using gxt 1.2.4.Code:FieldSet fieldSet = new FieldSet(); fieldSet.setHeading(" FieldSet title"); fieldSet.setCheckboxToggle(true); fieldSet.setExpanded(true); // something like that would be so nice :) fieldSet.setCheckboxChecked(true);
Can i do that with this version ?
Thanks in advance.
-
12 May 2009 3:58 AM #8
Hi A1ex!
Sven didn't send me anything. I solve this problem very silly, create in project my classes FiledSet and FiledSetEvent. Copy/past origin GXTcode and add method public InputElement getCheckbox() {
return checkbox;
}
It very ugly, but it works.
I hope this help.
-
12 May 2009 11:40 PM #9
hum ... and is it working ?
How do you manipulate de checkbox InputElement ?
Because when I look in the FieldSet code, I see the checkbox is checcked in the onRender.
I traced it with my debugger, I tried to force it at true.Code:protected void onRender(Element parent, int pos) { setElement(DOM.createFieldSet(), parent, pos); sinkEvents(Event.ONCLICK); Element legend = DOM.createLegend(); legend.setClassName("x-fieldset-header"); if (checkboxToggle) { checkbox = DOM.createInputCheck().cast(); if (checkboxName != null) { checkbox.setAttribute("name", checkboxName); } legend.appendChild(checkbox); checkbox.setChecked(!collapsed); } ...
Then i tried to create my own FiedlSet classe with a setChecked method, like this :
and nothing appened betterCode:public void setChecked(boolean checked) { this.checkbox.setChecked(checked); }
Then I tried the code of the example here (http://extjs.com/examples/forms/forms.html) and ....
no checked checkbox.
So I really don't understand what's wrong with this checkbox ??!!
Or what's wrong with my code.
-
13 May 2009 12:36 AM #10
Hi, A1ex.
Yes, it works, here is sample from my code:
...
// set field checked
statusFieldSet.expand();
setCheckedFieldSet( statusFieldSet, true );
// set field unchecked
timeIntervalFieldSet.collapse();
setCheckedFieldSet( timeIntervalFieldSet, false );
...
private void setCheckedFieldSet(FieldSet aFieldSet, Boolean isChecked) {
if(aFieldSet.getCheckbox() != null) {
aFieldSet.getCheckbox().setChecked( isChecked );
}
}
One moment, i use gxt version 1.2.2
Hope, this help.


Reply With Quote