I have dropdown checkboxes with function where if I click on an checkbox named 'ALL'
its will deselect all other selected checkbox, its working but when I try to do the other way around where on select checkboxes other than 'ALL'
it will deselect only 'ALL'
checkbox, it overlap with my first function, it does the job, but the 'ALL'
checkbox doesn't selected can anyone help me with this, any help is much appreciated.
Below is my code :
HTML :
<label class="text-primary" for="type">Type: </label>
<select id="type" mode="checkbox" style="width: 300;">
<option value="ALL" selected="Selected" checked="1">ALL</option>
<option value="Car">Car</option>
<option value="Ball">Ball</option>
<option value="Radio">Radio</option>
</select>
JAVASCRIPT:
type_combobox.attachEvent("onCheck", function(value, state){
var values = type_combobox.getChecked();
type_value = {};// put combo value into scope variable
for(var i = 0; i < values.length; i++){
type_value[values[i]] = true;// build hash for easy check later
}
//UNCHECK CHECKBOXES IF ALL IS SELECTED
if(type_value['ALL'] == true){
type_combobox.forEachOption(function(optId){
type_combobox.setChecked(optId.index,false);
})
type_combobox.setChecked(0,true);
}
gantt.render();// and repaint gantt
});
//InCORRECT
if(type_value['ALL'] == true && !type_value['ALL'] == false){
type_combobox.setChecked(0,false);
}
Aucun commentaire:
Enregistrer un commentaire