由于索引数组(来自API的返回值),以下是我想要增加数字的代码。
{
"data": "",
"defaultContent": "<img src='"+ imgStatusMap[orderDetails.orderItems[j].paymentStatus] +"' />
这里代替j
,我需要动态增加数字。
var table = $('#orderitems').DataTable( {
"pagingType": "simple",
//"pageLength": 1,
"oLanguage": {
"sInfo": "_START_-_END_ Of _TOTAL_",
"sInfoEmpty": "0-0 Of 0",
"oPaginate": {
"sNext": '<i class="fa fa-angle-right"></i>',
"sPrevious": '<i class="fa fa-angle-left"></i>'
}
},
data: orderDetails.orderItems,
"columns": [
{ "data": "orderId" },
{ "data": "orderDate" },
{ "data": "noOfItems" },
{ "data": "","defaultContent": "<img src='"+ imgStatusMap[orderDetails.orderItems[j].paymentStatus] +"' /> "+orderDetails.orderItems[j].paymentStatus },
{
"className" :'details-control glyphicon-plus',
"orderable" : false,
"data" :orderDetails.orderItems,
"defaultContent": ''
}],
"order": [[1, 'asc']]
});
任何人都有任何想法请帮助我。