Hi All,
I am trying to use the first item in a listbox as a Select all/none button. I have assigned a checkChange event to the listbox in this way:
$("#listbox").bind('checkChange', function (event) { var args = event.args; //get the item and it's label and value fields. var item = args.item; //I check or un check all just if the item with 0 value is changed if(item.value == 0){ // get new check state. var checked = args.checked; if(checked){ $("#listbox").jqxListBox('checkAll'); }else{ $("#listbox").jqxListBox('uncheckAll'); } }});
The problem is that the checkChange event, gets fired also when I call the checkAll & uncheckAll methods. The next error happens:
TypeError: item is undefined
I have tried with event.stopPropagation() as the first instruction of the checkChange event function, but it doesn’t work.
I can go through this error using a try/catch in the event function, but it’s not a “nice” solution.
Any other way to create a select all/none item inside the listbox?
thanks & regards
Jon Mikel