如何在数据表插件中的defaultContent中显示递增的数字

时间:2015-12-11 13:10:17

标签: jquery datatables jquery-datatables-editor

由于索引数组(来自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']]
     }); 

任何人都有任何想法请帮助我。

0 个答案:

没有答案