Custom Paging
Custom Paging
vraghu1983
Posts: 2Questions: 0Answers: 0
Hi,
I am relatively new to Jquery and datatables.
I am using C#.Net and SQL server 2005. I have got a web method which returns me 10 records as a list object, and on click of any of the paging buttons, i would need to call this method. I would also need to call this method on click of any of the header buttons of the table which is to be displayed. Could somebody please post me a sample code of how to do this?
I am relatively new to Jquery and datatables.
I am using C#.Net and SQL server 2005. I have got a web method which returns me 10 records as a list object, and on click of any of the paging buttons, i would need to call this method. I would also need to call this method on click of any of the header buttons of the table which is to be displayed. Could somebody please post me a sample code of how to do this?
This discussion has been closed.
Replies
I'm not 100% clear on what is needed here - it sounds rather like the server-side processing support that DataTables has built in: http://datatables.net/examples/data_sources/server_side.html . A query is sent to the server for each new page, or sorting / filtering etc.
If this isn't quite what you want, could you possibly provide more detail and I'll hopefully be able to point you in the right direction. Also the documentation on this site is quite extensive for how to integrate your own plug-in functions for paging etc with DataTables: http://datatables.net/development/pagination
Regards,
Allan
Thanks for your reply. The server side processing example shows the server side code being called.
the parameter "sAjaxSource" takes in the page name as a parameter. Was wondering if we could call a webmethod on the same.
Forgive my ignorance, but what is a webmethod? As in SOAP? You can target anything which returns a JSON string in the format that DataTables is expecting. If you are using an XML interface, then you will need a middle layer in order to convert the XML into JSON. This can probably be done quite readily with fnServerData() and a little bit of code to do the conversion. :-)
Regards,
Allan