当我编辑Jquery Datatable时,我在列表和编辑时选择了我创建的列,我还需要显示列表,例如dropdownlist,其中包含值,以便我可以选择并按Enter键。 / p>
那么我如何绑定一个下拉代替默认出现的文本框?
我的代码:
<script type="text/javascript">
$(document).ready(function () {
$('#myDataTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
//"bServerSide": true,
"aoColumns": [
{
"sName": "Lead_Id",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
return '<a href=\"Home\\LeadWizardView\\' + oObj.aData[0] + '\">To Wizard</a>';
}
},
{ "sName": "Contact_Name" },
{ "sName": "Contact_Address" },
{ "sName": "Lead_Source" }, //HERE lead-source should be a dropdown in datatable and data should be filled from DB into dropdownlist
{ "sName": "Domain" }
]
}).makeEditable({
sUpdateURL: "/Home/UpdateData",
sAddURL: "/Home/AddData",
sDeleteURL: "/Home/DeleteData",
});
</script>
}
<div id="demo">
<table id="myDataTable" class="display">
<thead>
<tr>
<th>Details</th>
<th>Contact Person</th>
<th>Contact Address</th>
<th>Lead Source</th>
<th>Domain</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Lead_complete_list)
{
<tr id="@item.Lead_Id">
<td >@item.Lead_Id</td>
<td>@item.Contact_Name</td>
<td>@item.Contact_Address</td>
<td>@item.Lead_Source</td>
<td>@item.Domain</td>
</tr>
}
</tbody>
</table>
此致
答案 0 :(得分:0)
http://jquery-datatables-editable.googlecode.com/svn/trunk/custom-editors.html处的数据表页面提供了使用下拉列表的示例 - 只需点击最后一列。