标签:att 添加 created func href tab lan cat function
http://legacy.datatables.net/usage/callbacks#fnRowCallback
主要通过 fnCreatedRow 事件来实现
var table = $(‘#table_id‘).dataTable( { "processing": true, "serverSide": true, "ajax": { "url": "#", "type": "POST", "data" : { "action" : "table-ajax-data" } }, "columns": [ { "data": ‘id‘, "name": ‘编号‘, "width": ‘80px‘ }, { "data": ‘cat‘, "name": ‘分类‘ }, { "data": ‘sub_cat‘, "name": ‘子类‘, "orderable": false, "visible": false, "searchable": false } ], "fnCreatedRow": function( nRow, aData, iDataIndex ) { if( typeof( aData.id ) != "undefined" ) { $( nRow ).attr( "tr_id", aData.id ); } } } );
黄聪:Jquery+DataTables插件,如何在ajax调用服务器数据后,自动给tr添加id属性
标签:att 添加 created func href tab lan cat function
原文地址:http://www.cnblogs.com/huangcong/p/7634543.html