您好我想以动态方式更改select元素的来源。我有这段代码:
$('.responsible').editable({
source: [{id_pass:56, text:"AAG"}, {id_pass:9, text:"AE"}, {id_pass:45, text:"ECH"}, {id_pass:17, text:"GM"}
, {id_pass:6, text:"JG"}, {id_pass:26, text:"JS"}],
select2:{
width:'112px',
tokenSeparators: [",", " "],
multiple:true,
id: function (item) {
return item.id_pass;
},
placeholder: "Select a user"
},
success: function(response, newValue) {
///this doesn't work
$(this).editable('option', 'source', response.new_source);
}
});
在某些情况下,必须删除的元素不再出现在选择列表中,这就是它更改源的原因。 我能做什么? 谢谢。