我想通过在特定索引上添加key =>值对来更新数据表对象,如下面是我的数据表对象值。所以我只想在jquery的列[0] ['搜索'] 索引下添加一个键值对。我试过这个 dataTable.columns(0).search({"键":"值"})。绘制();但它不起作用.-
Array
(
[draw] => 2
[columns] => Array
(
[0] => Array
(
[data] => 0
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[1] => Array
(
[data] => 1
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[2] => Array
(
[data] => 2
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[3] => Array
(
[data] => 3
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[4] => Array
(
[data] => 4
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[5] => Array
(
[data] => 5
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] => [object Object]
[regex] => false
)
)
[6] => Array
(
[data] => 6
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[7] => Array
(
[data] => 7
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[8] => Array
(
[data] => 8
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
[9] => Array
(
[data] => 9
[name] =>
[searchable] => true
[orderable] => true
[search] => Array
(
[value] =>
[regex] => false
)
)
)
[order] => Array
(
[0] => Array
(
[column] => 0
[dir] => desc
)
)
[start] => 0
[length] => 10
[search] => Array
(
[value] =>
[regex] => false
)
[type] => mytask
)
答案 0 :(得分:0)
如果要向服务器提交其他键/值对,请使用ajax.data
选项。
例如:
$('#example').dataTable( {
"ajax": {
"url": "data.json",
"data": function ( d ) {
d.extra_search = $('#extra').val();
}
}
} );