我找到了我们需要宣布的答案
slno
在beans类中,将其添加到json字符串并发送到ajax
$('#salestbl').DataTable( {
"fnRowCallback" : function(nRow, aData, iDisplayIndex){
$("td:first", nRow).html(iDisplayIndex +1);
return nRow;
},
destroy: true,
data: response,
columns: [
{ data: 'nRow' },
{ data: 'invoiceNum' },
{ data: 'totalAmt' },
{ data: 'disAmt' },
{ data: 'taxAmt' },
{ data: 'grandTotal' },
{ data: 'date' }
]
} );
不应该在这里
{ data: 'nRow' },
它应该是我们类的成员变量
{ data: 'slno' },
然后数据表将为
first td of every row
使用
"fnRowCallback" : function(nRow, aData, iDisplayIndex){
$("td:first", nRow).html(iDisplayIndex +1);
return nRow;
},
以上功能,感谢您曾经回答过我的问题。