Categories | Question details Back To List | ||
dhtmlxCombo Checkbox Hello, How can i get number of elements on dhtmlxCombo (Checked and no Checked) ? length ? Thanks Best regards Ke Answer posted by Alex (support) on Nov 26, 2009 07:55 Hello there isn't a method to get a total number of options. But it can be done using optionArr private property: var total_number = combo.optionsArr.length; /*combo is combo object*/ The getChecked() method return array with values of checked options. So, number of checked elements is: var checked_arr = combo.getChecked(); var checked_number = checked_arr.length; Answer posted by ke on Nov 26, 2009 08:05 Ok, thanks you,
other question, can we add a checkbox TOTAL to checked all the checkbox on a combo ? Answer posted by Alex (support) on Nov 26, 2009 09:50 Combo doesn't provide API to check option. But you can try to use the following method that allows to check/uncheck all options in combo in TOTAL option is checked/unchecked: combo.attachEvent("onCheck",function(val,state){ for(var i = 0; i < this.optionsArr.length; i++){ if(this.optionsArr[i].value!="total") this.optionsArr[i].content.firstChild.checked = state; } } return true }) Where "total" is value of the "TOTAL" option. |