0

如何在 jquery 数据表中定义具有多项选择的下拉菜单,我正在使用以下代码,请告诉我:

aoColumns: [      null,
                    null,
                    null,null,
                    { type: "date-range" },
                    { type: "select",values:['1', '2', '3','4','5']},
                    { type: "date-range" },
                    { type: "text" },
                    null,
                    null,

                ]});
4

1 回答 1

0

使用 jQuery 选择的插件:http ://davidwalsh.name/jquery-chosen

并输入以下代码:

var selectMulti = "<select class='chosen' multiple='true' style='width:200px;'>"
                    + "<option>1</option>"
                    + "<option>2</option>"
                    + "<option>3</option>"
                    + "<option>4</option>"
                    + "<option>5</option>"
                + "</select>";

//inside the constructor of datatable, put this:
aoColumns: [      null,
                    null,
                    null,null,
                    { "type": "date-range" },
                    { "sTitle" : selectMulti},
                    { "type": "date-range" },
                    { "type": "text" },
                    null,
                    null,

                ]});

//after build the datatable, run this code
$(".chosen").chosen();
于 2013-09-27T13:38:06.097 回答