下载及代码:http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/index.htm#filter
api(参数):http://www.erichynds.com/blog/jquery-ui-multiselect-widget
Demo:http://www.erichynds.com/examples/jquery-multiselect/examples.htm
效果:
自己使用:
常用及汉化:
$("#assignUserId").multiselect({
header: "选择处理人",
noneSelectedText: "未选择",
checkAllText: "选择全部",
uncheckAllText: "取消全部",
minWidth:150,
selectedText: function(numChecked, numTotal, checkedItems){
return $(checkedItems[0]).next('span').html();
}
});
var array_of_checked_values = $("#assignUserId").multiselect("getChecked").map(function(){
return this.value;
}).get();
默认选中:
$("select option:nth-child(1), select option:nth-child(3)").attr("selected", "selected");
$("select").multiselect("refresh");
获得选中:
var array_of_checked_values = $("#assignUserId").multiselect("getChecked").map(function(){
return this.value;
}).get();
配置:
defaultMultiselectOptions : {
header: false,
noneSelectedText: "请选择",
checkAllText: "选择全部",
uncheckAllText: "取消全部",
minWidth:150,
selectedText: function(numChecked, numTotal, checkedItems){
return $(checkedItems).map(function(){
return $(this).next('span').html();
}).get();
}
}