Can DataTables be used to display content resulting after a search over database?

Can DataTables be used to display content resulting after a search over database?

iSumitGiSumitG Posts: 1Questions: 0Answers: 0
edited July 2011 in DataTables 1.8
I am working on a e-commerce website. I want to show search results filtered by "Brand Name", "Price Range" etc. The results are first fetched from the database and then displayed over several numbered pages (like page1: results 1 to 20, page2: results 20-40) etc. Can I use DataTables to implement this functionality. Also can you please suggest where to start?
I am using PHP, MySQL, Apache server on a Windows Machine.

Thanks!

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    yes. you can either perform the database call and populate your page data directly or you can perform javascript calls to a server script that performs your filter query.

    for the first option, you can either print your database results straight to HTML code (the table) or create an object with the data (array of arrays, for instance) and use that to intialize the table - see http://www.datatables.net/release-datatables/examples/data_sources/js_array.html

    for javascript call to back-end server, see http://www.datatables.net/release-datatables/examples/server_side/server_side.html
  • GregPGregP Posts: 500Questions: 10Answers: 0
    fbas has it right, I just wanted to throw in that not only CAN you do it, but DataTables is the ideal fit.
This discussion has been closed.