page.dt event not firing properly

page.dt event not firing properly

Tylerlee12Tylerlee12 Posts: 8Questions: 5Answers: 0

Hi guys,

So I'm attempting to use the page.dt event to listen for when the page is changed on my datatable, but it only fires when I click on the arrow keys and not when I click on the paginated numbers. Any idea on how to solve this problem?

Link to datatables debug: http://debug.datatables.net/oxuhav

Answers

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    It seems to work okay here: http://live.datatables.net/niporuxo/1/edit .

    Can you link to a test case showing the issue please or modify my example to show the problem?

    Allan

  • Tylerlee12Tylerlee12 Posts: 8Questions: 5Answers: 0
    edited August 2014

    Hi allan,

    I can link you to the page, but I'd prefer to send it to you over private message. Is that okay? Once we are able to resolve the issue I will come back to this thread and post the solution so that others can learn if they are having the same problem.

    Let me know, thanks.

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    Yeah sure. Click on my forum name in this post then then "Send Message" in the page that opens.

    Allan

  • Tylerlee12Tylerlee12 Posts: 8Questions: 5Answers: 0

    Sending you a message now. If we solve this I will be back to post the solution.

  • SiqiSiqi Posts: 2Questions: 0Answers: 0

    Hi allan and Tylerlee12,
    I'm encountering the same problem. Could you please post the solution about how to solve this problem?

     Thank you very much!
    
  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    The issue that @Tylerlee12 was seeing was that an old version of DataTables was being used. If you already already using the latest release (1.10.2 at the time of writing), please update.

    If you are already using the latest release, please link to a test case, as per the forum rules.

    Allan

  • SiqiSiqi Posts: 2Questions: 0Answers: 0

    Thank you, Allan.
    I used "dataTables.bootstrap.js" of latest release(1.10.2) and encountered that problem. And now , I change the src to: " //cdn.datatables.net/plug-ins/725b2a2115b/integration/bootstrap/3/dataTables.bootstrap.js" , and then page.dt works.

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    Good to hear - thanks for letting me know.

    Allan

  • mcgeemcgee Posts: 10Questions: 5Answers: 0
    edited September 2014

    I am having a similiar problem. I'm using the most recent version of datatables from the cdn and also using the src link given above. I keep getting the following console error when I click a page from the pager.

    table.page is undefined

    my code is as follows:-

    $(document).ready(function() { var table= $('#locations_datatable').dataTable({ "columns": [ { "name": "location" }, { "name": "value" }, { "name": "profile","orderable": false} ] ,"language": {"search": ""} ,"order": [[ 1, "desc" ]] ,"dom": 'frtp'}); $('#locations_datatable').on( 'page.dt', function () { var info = table.page.info(); alert(info.page); } ); } );

    Any ideas?

    Thanks

  • mcgeemcgee Posts: 10Questions: 5Answers: 0

    Was able use the //cdn.datatables.net/plug-ins/725b2a2115b/api/fnPagingInfo.js plugin and then change my code to this:-

    $(document).ready(function() { var table= $('#locations_datatable').dataTable({ "columns": [ { "name": "location" }, { "name": "value" }, { "name": "profile","orderable": false} ] ,"language": {"search": ""} ,"order": [[ 1, "desc" ]] ,"dom": 'frtp' }); $('#locations_datatable').on( 'page.dt', function () { alert(table.fnPagingInfo().iPage); }); } );

    Have to use , doesnt work with bootstrap 2.

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    @mcgee - Please link to a test case. Having said that, the Bootstrap 2 integration is likely to be deprecated soon.

    Allan

  • PaulB67PaulB67 Posts: 1Questions: 0Answers: 0

    Similar to the comment made by @Siqi, we are using 1.10.2 and dataTables.foundation.js which leverages a similar Bootstrap style pagination control. The latest nightly builds do seem to address this issue. Do you have a target date for the next Stable build?

    Thanks

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin

    Stable build of DataTables or the integration plug-in? For DataTables I hope later today, although possibly tomorrow depending on how things go.

    Allan

This discussion has been closed.