use disabled attribute in select source, fix #287
This commit is contained in:
parent
986613996f
commit
f95dd38b06
@ -33,12 +33,19 @@ $(function(){
|
||||
this.$input.empty();
|
||||
|
||||
var fillItems = function($el, data) {
|
||||
var attr;
|
||||
if($.isArray(data)) {
|
||||
for(var i=0; i<data.length; i++) {
|
||||
attr = {};
|
||||
if(data[i].children) {
|
||||
$el.append(fillItems($('<optgroup>', {label: data[i].text}), data[i].children));
|
||||
attr.label = data[i].text;
|
||||
$el.append(fillItems($('<optgroup>', attr), data[i].children));
|
||||
} else {
|
||||
$el.append($('<option>', {value: data[i].value}).text(data[i].text));
|
||||
attr.value = data[i].value;
|
||||
if(data[i].disabled) {
|
||||
attr.disabled = true;
|
||||
}
|
||||
$el.append($('<option>', attr).text(data[i].text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user