简体   繁体   中英

jquery dataTable pagination not appearing

i am working with http://datatables.net/ within a grails application this is my initialization code:

<g:javascript>
    $(document).ready(function () {
       var oTable = $('#projectTable').dataTable({
            "bSort": false,
            "sPaginationType": "full_numbers"
        });

        oTable.columnFilter({
            sPlaceHolder: "head:before",
            aoColumns: [
                { sSelector: "#projectIdFilter" },
                { sSelector: "#projectNameFilter" },
                { sSelector: "#projectStatusFilter", type: "select" },
                { sSelector: "#projectModifiedFilter"},
                { sSelector: "#projectActionablesFilter" }
            ]
        });
    });

    function resetFilters() {
        var oTable = $('#projectTable').dataTable();
        var oSettings = oTable.fnSettings();
        for(iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) {
            oSettings.aoPreSearchCols[iCol].sSearch = '';
        }
        oTable.fnDraw();
        $('#filter_Name').val('');
        $('#filter_Project_ID').val('');
        $('#filter_Modified').val('');
        $('#filter_Status').val('Status');
        $('#filter_Actionables').val('');
    }

</g:javascript>

my testdata covers 30 data rows and works just fine (filtering, clearing filters, etc...) the only issue is, that the pagination will not show up.

分页问题的屏幕截图

as you see:

  • pagination is working in the background ( showing 1-1 of 30 )
  • First text is appearing, although not clickeable (as currently on first page)

i have tried a lot of different pagingType, bPaginate, bSort,... things but nothing seems to work.

Any ideas? issues with the underlying grails application?

Small addon issue/information: if i remove bSort: false the pagination breaks completely and all projects are listed (1 through 30) on one page.

For javascript, i've use only sPaginationType to initialize the data table.
I'm always use this code for data table. Let build the data table step by step. Use this code only, then check whether it's working or not.

Note: Please remove all other javascript files other than data table js and css files. I got a issue that data table is not working with jquery calender. Let try this and let me know.

    $('#table_name').dataTable({
      "sPaginationType": "full_numbers"
      })
    .columnFilter({sPlaceHolder: "head:before",
      aoColumns: [{type: "text" },{type: "text" },{type: "text" },{type: "text" },{type: "text" },{type: "text" }]
    });

数据表

I found the solution - a mixup of two different jquery versions one included automatically by aui (atlassian user interface) and another manually by me. the wrong one was chosen in the end and led to missing pagination.

solution therefore:

<script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM