使用json添加行DataTable

时间:2018-07-27 10:02:52

标签: php jquery json datatables

我有一个带有DataTable,JQuery的表,并且用php返回了一个json,但没有在表的行中添加数据。

var table = $('#list').DataTable();
table.row.add([{"id":"1","name":"other", "action":"edit"}]);

3 个答案:

答案 0 :(得分:2)

我认为这行应该可行:

String command = "killall 'Safari'";
Process p = Runtime.getRuntime().exec(command);

BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";

while ((line = r.readLine()) != null) {
    System.out.println(line);
}
p.destroy();
p.destroyForcibly();

答案 1 :(得分:0)

尝试以下代码:

var table = $('#list').DataTable();
table.row.add([{"id":"1","name":"other", "action":"edit"}]).draw();

答案 2 :(得分:0)

尝试一下

var table = $('#list').DataTable();
table.row.add({"id":"1","name":"other", "action":"edit"}).draw();