jQuery dataTables add id to added row

前端 未结 6 1938
粉色の甜心
粉色の甜心 2020-12-18 23:08

Is it possible to add ID to last added row with jQuery DataTables (e.g., ...) ?

$(\'#example\').dataTable().fnA         


        
6条回答
  •  感动是毒
    2020-12-18 23:39

    Hope below code will help you

    var rowid = $('#example').dataTable().fnAddData( [
        "col_value_1",
        "col_value_2",
        "col_value_3",
        "col_value_4" ] );
    var theNode = $('#example').dataTable().fnSettings().aoData[rowid[0]].nTr;
    theNode.setAttribute('id','your value');
    

提交回复
热议问题