intercept event on the next and prev buttons

intercept event on the next and prev buttons

lucioanneoalex@gmail.comlucioanneoalex@gmail.com Posts: 7Questions: 3Answers: 0

Hello,
I am using the data table with pagination manually. Is there a way to intercept the page next and prev click events so to call an ajax function to add the appropriate rows ?
thanks for any answer

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I guess you could unbind our event listener and then attach your own, but no, that isn't a feature of DataTables. I actually don't understand why you'd want to do that. I sounds like you want to load just a page of data at a time (good for large data sets). That's what our server-side processing mode is for.

    Allan

  • lucioanneoalex@gmail.comlucioanneoalex@gmail.com Posts: 7Questions: 3Answers: 0

    Hello Allan,
    thanks for your reply. Below I try to explain better.
    I am using the table in client side mode (since I need to add manually some rows from a signalr source every now and then),
    but I use also the DB as a manual source (i.e. at the first load of the table).
    So, when the application starts I make an ajax call that gives me back 10 rows + the total number of rows (i.e. 1000) since I do not want to load everything but just the page I am interested in.
    I easily manage to add 10 rows to the table but I need to tell the data table that the total number of rows is 1000, so to
    enable and intercept the next and prev events of the paging control and subsequently ask the server for the right slice of 10 records.
    Is this scenario feasible with the present paging control?
    thanks

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    Answer ✓

    As Allan said the Datatables supported version of server side paging is Server Side Processing mode. If you want to implement your own paging then you can either, as Allan mentioned, turn of the Datatable event. listeners and create your own. Or you could create your own paging buttons.

    Kevin

  • lucioanneoalex@gmail.comlucioanneoalex@gmail.com Posts: 7Questions: 3Answers: 0

    ok, thanks for your clarification

Sign In or Register to comment.