[英]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.