Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 函数row.add()在我的函数中不起作用:_Javascript_Jquery_Datatables - Fatal编程技术网

Javascript 函数row.add()在我的函数中不起作用:

Javascript 函数row.add()在我的函数中不起作用:,javascript,jquery,datatables,Javascript,Jquery,Datatables,函数row.add no work correct,要创建数据表: var target=$(table.dt-table); //i test and only exist one. target.DataTable(options); 尝试在同一函数中添加一行: if(addrow!=null){target.row.add(addrow).draw();} //addrow i a var with array. 我得到这个错误: Uncaught TypeError: Cannot

函数row.add no work correct,要创建数据表:

var target=$(table.dt-table); //i test and only exist one.
target.DataTable(options);
尝试在同一函数中添加一行:

if(addrow!=null){target.row.add(addrow).draw();} //addrow i a var with array.
我得到这个错误:

Uncaught TypeError: Cannot read property 'add' of undefined
我需要向现有数据表中添加一行。以任何方式使用row.add()或添加html原始代码。

var table=$('#示例').DataTable()//
var table = $('#example').DataTable(); // <-- use the returned object from .DataTable() and not the jQuery object

table.row.add( {
        "name":       "Tiger Nixon",
        "position":   "System Architect",
        "salary":     "$3,120",
        "start_date": "2011/04/25",
        "office":     "Edinburgh",
        "extn":       "5421"
    } ).draw();