Drop-down box a checkbox tree

   There is a drop-down box to change the radio multiple choice, there is also an all-option, when all you want to check on all the time, like a tree drop-down box. Results are as follows:

       

 

The data transmitted back to do modify according to their needs, select all the time when all this will only pass a value, but check out the background of the data is to satisfy all, of course, cancel all the time at the time of the query also still have to meet all entries. code show as below:

Add fSelect.css, jquery.js, fSelect.js

-----html-----

<SELECT class = "Demo" V-Model = "preType" Multiple = "Multiple">
<Option value = "-. 1"> All </ Option>
<Option value = ". 1"> commonly prescribed </ Option>
<Option value = "2"> extract stream side </ Option>
<Option value = ". 3"> traditional paste </ Option>
<Option value = ". 4"> slice paste </ Option>
<Option value = ". 5 "> narcotic prescription </ option>
<the Option value =" 6 "> emergency prescription </ option>
<the Option value =" 7 "> pediatric prescription </ option>
<the Option value =" 8 "> psychoactive drugs </ option >
<Option value = ". 9"> pills </ Option>
<Option value = "10"> paste </ Option>
<Option value = "11 "> Agreement Paste </ Option>
<Option value =" 12 is "> prescription in </ Option>
<Option value =" 13 is "> small package </ Option>
<Option value =" 14 "> Herbal Wrap </ Option>  
</ SELECT>

 ------script---------

$('.demo').fSelect({
     showSearch: false,
     placeholder:'全部'
});

 The following is a selection of the acquisition value, just do not know why select the data source can not be dynamically loaded, but also look great coffee Ariadne

var selet = [].map.call($('.fs-option.selected'), function (el) {
if (el.dataset.value == "-1")
return "-1";
else
return el.dataset.value
})

That's it, just to have my needs changes to the code, the search box also removed, taken from the original: https://github.com/mgibbs189/fSelect

My fSelect.js a little change.

 

Guess you like

Origin www.cnblogs.com/w1-y2-q5/p/11777092.html