[英]How do i get a value from a cell in jquery datatables clicking on dropdown inside a row
[英]Datatables: How do I get the row with certain cell value?
下面是我创建的表:
var table= $("#mytable").DataTable({
ajax: "list.json",
columns: [
{"data": "name"},
{"data": "location"},
{"data": "date"}
]
});
现在,我想编辑name
为“ John”的行中的location
。 我尝试过这种方式:
table.search("John").column(0).row(0).cell(1).data(" New location ");
但这由于我不知道的原因而行不通。 任何帮助,将不胜感激。
您可以这样尝试:
foreach(DataRow dr in table.Rows) // Search whole table
{
if(dr["name"] == "John") // If name== 'John'
{
dr["location"] = "New location"; //Change the location
//break;
}
else if()
{
// Do Something else
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.