jquery jtable show 1 2 3 NAN NAN 4中的分页


Pagination in jquery jtable show 1 2 3 NAN NAN 4

我正在尝试显示每页10 records,但NAN值如何 下面是代码片段

$('#JarDistHist').jtable('detach');
$('#JarDistHist').jtable({
            title: 'Jar Distribution History',
            paging: true,
            pageSize: 10,
            sorting: true,
            defaultSorting: 'Date ASC',
            actions: {
                listAction: 'StudentActions.php?action=list&DistId='+cname+'&fitem='+fitem+'',
                deleteAction: 'StudentActions.php?action=delete'
            },
            fields: {
                id: {
                    key: true,
                    create: false,
                    edit: false,
                    list: false,
                    },
                Date: {
                    title: ' Date',
                    type: 'date',
                     displayFormat: 'dd-mm-y',
                    width: '40%'

                },
                TotRecvJars: {
                    title: 'Rec. ',
                    width: '30%',
                    display: function (data) {
                     return $('<a href="JarFillingDetail.php?id=' + data.record.id + '">'+data.record.TotRecvJars+'</a>');
                     // return  $('<a href="JarFillingDetail.php?id=' + data.record.id + '">'+data.record.Date.format('DD-MM-YY')+');
                     }
                },
                NoOfJarsFill: {
                    title: 'Filled ',
                    width: '30%',
                    type:'integer',
                    display: function (data) {
                     return $('<a href="JarFillingDetail.php?id=' + data.record.id + '">'+data.record.NoOfJarsFill+'</a>');

                     }
                },
                BalanceJars: {
                    title: 'Bal. ',
                    width: '30%',
                    type:'integer',
                    display: function (data) {
                     return $('<a href="JarFillingDetail.php?id=' + data.record.id + '">'+data.record.BalanceJars+'</a>');

                     }
                }
            }
        });
        //Load person list from server
        $('#JarDistHist').jtable('load');

在你的列定义中,你说的是type: 'integer'(NoOfJarsFill 和 BalanceJars),这意味着你想要显示一个数字。但是,您返回的HTML内容作为值,这不是一个数字。"不是数字"正是NAN所代表的。

type: 'integer'更改为type: 'string',您的问题将得到解决。