Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset dojo CheckedMultiSelect

The widget is inside the form, however

form.reset()

does not clear the previously selected values of CheckedMultiSelect.

var list = new CheckedMultiSelect({
    dropDown: true,
    labelText: 'States',
    multiple: true,
    name: 'state',
    onChange: getValues,
    required: false
}, "stateSelect");

I have tried code below but it doesnt work.

list.reset()

Thanks in advance

like image 616
Coder Avatar asked Jan 11 '23 15:01

Coder


1 Answers

You can change the value of CheckedMultiSelect via list.set('value',[...]). The selection is updated immediately, when the list is not empty...

To clear the selection, call:

list.set('value',[]);
list._updateSelection();

Tested on Dojo 1.9.2.

like image 87
Danubian Sailor Avatar answered Jan 21 '23 21:01

Danubian Sailor