Chosen is a jQuery plugin that makes long, unwieldy select boxes much more user-friendly.
https://harvesthq.github.io/chosen/
.net MVC下实装小栗:
1.在对应的Controller里准备好数据源
比如:
ViewBag.専用場所CD = new SelectList(db.M_SenyouBasyos, "専用場所CD", "専用場所名", t10_備品台帳.専用場所CD);
2.页面绑定
Html.DropDownList("専用場所CD", null, new { @class = "chzn-select" })
@Html.ValidationMessageFor(model => model.専用場所CD)
3.配置chosen
$(".chzn-select").chosen(
{
no_results_text: "候補値が見つかりません:",
search_contains: true
});
$(".chzn-select-deselect").chosen({ allow_single_deselect: true, no_results_text: '候補値が見つかりません' });
4.想直接控制chosen的width?
用JS搞定:
$(".chosen-container").css("width", "100%");
posted on 2016-03-14 15:27
Ying-er 阅读(3789)
评论(2) 编辑 收藏 所属分类:
JQuery 、
.Net