1

I can't get my pagination to work after I added a date filtering plug-in to datatables. The original code was like this and it was picking up the pagination fine.

$(document).ready(function() {

 $('#table1').dataTable({
  'sPaginationType': 'full_numbers'
 });

this is my current one with the plug in variables

$(document).ready(function() {
 var oTable = $('#table1').dataTable();
 "sPaginationType": "full_numbers"
 /* Add event listeners to the two range filtering inputs */
 $('#min').keyup( function() { oTable.fnDraw(); } );
 $('#max').keyup( function() { oTable.fnDraw(); } );

});

Thanks in advance.

1
  • I'd recommend asking on the Datatables forums. I asked a few questions on there when I was doing some work with the plugin and they were answered quickly. The plugin developer uses the forums too, so somebody there will be able to help. Commented Feb 15, 2012 at 12:42

1 Answer 1

4

Well, in your current function, this part:

var oTable = $('#table1').dataTable();
"sPaginationType": "full_numbers"

should be written like this:

var oTable = $('#table1').dataTable({
    'sPaginationType': 'full_numbers'
});

Edit

In case it wasn't clear, the full jQuery code should look like this:

$(document).ready(function() {
    var oTable = $('#table1').dataTable({
        'sPaginationType': 'full_numbers'
    });
    /* Add event listeners to the two range filtering inputs */
    $('#min').keyup( function() { oTable.fnDraw(); } );
    $('#max').keyup( function() { oTable.fnDraw(); } );
});
Sign up to request clarification or add additional context in comments.

2 Comments

i've updated it now im getting this error.DataTables warning (table id = 'table1'): Cannot reinitialise DataTable. To retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster).
@glenn: I'm not sure, but it sounds like you are creating duplicate dataTables. Can you edit your question to include your current jQuery code and the relevant HTML? I've edited my answer to include the full example in case it wasn't clear enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.