jQuery datatable-settings对象的哪个属性显示"分页"数据表的真实与否?

时间:2016-02-02 10:05:58

标签: javascript jquery pagination datatables settings

以下是代码:

var $oTable = $('#table').DataTable( {"bPaginate" : true}; );

The following piece of code returns the settings object"
$oTable.settings()[0]

现在,我需要知道设置对象的属性,它表示是否"分页"是真还是假。以下是在浏览器控制台中显示设置对象的图像:

Image that shows the settings object of datatable

2 个答案:

答案 0 :(得分:0)

oFeatures和oInit下的

bPaginate bServerSide

console log screenshot

答案 1 :(得分:0)

jquery.dataTables.js 1.9.4上搜索我没有看到任何属性,我认为你必须做类似于这个版本的功能:

    function _fnCalculateEnd( oSettings )
    {
        if ( oSettings.oFeatures.bPaginate === false )
        {
            oSettings._iDisplayEnd = oSettings.aiDisplay.length;
        }
        else
        {
            /* Set the end point of the display - based on how many elements there are
             * still to display
             */
            if ( oSettings._iDisplayStart + oSettings._iDisplayLength > oSettings.aiDisplay.length ||
                   oSettings._iDisplayLength == -1 )
            {
                oSettings._iDisplayEnd = oSettings.aiDisplay.length;
            }
            else
            {
                oSettings._iDisplayEnd = oSettings._iDisplayStart + oSettings._iDisplayLength;
            }
        }
    }

所以你必须知道是否有分页看着 _iDisplayStart _iDisplayLength (基础+偏移)和结果数组的长度 aiDisplay