Checkbox setDisabled(true) not working
Hi
I am using custommultifield component which have a text and a checkbox. I want to achieve one selection of checkbox & other makes disable. Below is my listener for selection changed which is one on the item in multifield.
function(selection,value,checked){ var dialog = this.findParentByType('dialog'); var itemTemp; var multifield = this.findParentByType('customconfigmultifield'); var arr = multifield.items; console.log(arr.getCount()); if(checked){ for (var i = 0 ; i < arr.getCount()-1 ; i ++){ itemTemp = arr.get(i).findByType('selection')[0]; itemTemp.setDisabled(true); } selection.setDisabled(false); } else{ for (var i = 0 ; i < arr.getCount() ; i ++){ itemTemp = arr.get(i).findByType('selection')[0]; itemTemp.setDisabled(false); } } }At begin when i drop the component and select one checkbox, its disables all other checkboxes. After Ok when i edit/reopen the dialog, It shows checkbox above the selected one are disabled, but below that all are enable along with that. Also my arr.count comes only till the selected tab. Here is the image of selected node in crxde.
Dialog.xml :
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="cq:Dialog" title="dialog" xtype="dialog"> <items jcr:primaryType="cq:Widget" xtype="tabpanel"> <items jcr:primaryType="cq:WidgetCollection"> <tabcontrolpanel jcr:primaryType="cq:Panel" itemId="panel1" title="Tabs Panel"> <items jcr:primaryType="cq:WidgetCollection"> <typeconfigs jcr:primaryType="cq:Widget" fieldLabel="Tabs" itemId="customfield" name="./options" width="{Long}100" xtype="customconfigmultifield"> <fieldConfigs jcr:primaryType="cq:WidgetCollection"> <option jcr:primaryType="cq:Widget" hidden="{Boolean}true" name="option_name" xtype="textfield"/> <optionval jcr:primaryType="cq:Widget" allowBlank="{Boolean}false" defaultValue="Test" fieldLabel="Title" maxLength="{Long}40" name="optionval" xtype="textfield"/> <displayoptions jcr:primaryType="cq:Widget" defaultValue="nonactive" itemId="dispotions" name="selecttab" type="checkbox" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <one jcr:primaryType="nt:unstructured" text="Refresh tab list" value="active"/> </options> <listeners jcr:primaryType="nt:unstructured" selectionchanged="listener posted above"/> </displayoptions> </fieldConfigs> </typeconfigs> </items> </tabcontrolpanel> </items> </items>
Thanks