如何使用mvc中的jquery datatable向控制器中的值添加下拉列表到每一行。 [英] How to add a dropdown list to each rows with values from controller using jquery datatable in mvc.
问题描述
如何使用mvc中的jquery datatable向控制器中的值添加每个行的下拉列表。
我使用ajax调用使用以下代码填充数据:
var tbldet = $(#myTable)。DataTable({
ajax:{
url:GetCustomers,
type:POST,
datatype:json
},
栏目:[
{data:CustomerID},
{data:Customer_Name},
{data:Cust_code}
]
< br $> b $ b
});
我的尝试:
已尝试使用mrender选项添加下拉列表,但失败了。
how to add a dropdown list to each rows with values from controller using jquery datatable in mvc.
I am using ajax call to populate data using below code:
var tbldet = $("#myTable").DataTable({
"ajax": {
"url": "GetCustomers",
"type": "POST",
"datatype": "json"
},
"columns": [
{ "data": "CustomerID" },
{ "data": "Customer_Name" },
{ "data": "Cust_code" }
]
});
What I have tried:
is have tried using mrender option to add a dropdown list,but failed.
推荐答案
(#myTable) ·DA taTable({
ajax:{
url:GetCustomers,
type:POST,
datatype:json
},
列:[
{data: CustomerID},
{data:Customer_Name},
{data:Cust_code}
]
});
我尝试了什么:
尝试使用mrender选项添加下拉列表,但失败了。
("#myTable").DataTable({
"ajax": {
"url": "GetCustomers",
"type": "POST",
"datatype": "json"
},
"columns": [
{ "data": "CustomerID" },
{ "data": "Customer_Name" },
{ "data": "Cust_code" }
]
});
What I have tried:
is have tried using mrender option to add a dropdown list,but failed.
你可以使用datatble render方法绑定dropdown。请检查此链接
带有下拉列的数据表 - JSFiddle [ ^ ]
You can use datatble render method to bind dropdown.Please check this link
DataTable with dropdown Column - JSFiddle[^]
这篇关于如何使用mvc中的jquery datatable向控制器中的值添加下拉列表到每一行。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!