Can I override function for paging and sorting action?

Can I override function for paging and sorting action?

buaayttbuaaytt Posts: 12Questions: 0Answers: 0
edited October 2013 in General
Simply put, how can I make my own function when user clicks one column header to sort? Same goes to paging. How can I make my own function when user clicks next page, for example?

In addition, how can I return only 1 page of data (e.g. 10 records) from server, while still letting dataTables believe I have overall 99 records to show in 10 pages?

Thanks for any help.

Nico

Replies

  • buaayttbuaaytt Posts: 12Questions: 0Answers: 0
    I may have made the question a bit awkward to understand. Here's my solution:

    I don't want to get into much details of how dataTables work. Instead, I could provide the complete structure, including and . Of course, all data will be put into and , all done at server side. The client dataTables framework is only responsible to transform the complete section to the dataTables layout, with all pagination and sorting actions enabled.

    However, I still only return 1 page of data each time. So I would like to do the following things:

    1) tell dataTables that I've got totally 99 records to show, but display only 10 records on one page; That way, the correct pagination info can be displayed.
    2) get informed when user performs sorting or paging action. I can't let dataTables do this for me because it has no knowledge of any details of data to display. Its work is simply transform the existing to a dataTables object. So I'd intercept these actions, perform server-side processing, building a complete element to return and let dataTables only handle the transform.

    Would be appreciated for any help.
This discussion has been closed.