doing join queries and inputting dynamic filtering

doing join queries and inputting dynamic filtering

emelianenkoemelianenko Posts: 18Questions: 0Answers: 0
edited September 2010 in General
Hello,

I have read the examples of datasources, static, ajax, server.

the interesting variant is being able to send filtering parameters from the client side (via select boxes) for example and have those parameters in the php script delivering paginated tables in real time)

One example from another user is mentioned, but we dont see what changes have been made on the client side, and also his example is rather easy as he joins the table to itself and has no where clauses. therefore, it receives no parameters from the client side.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Do you mean adding a new row based on dynamic data? Something like this: http://datatables.net/examples/api/add_row.html (which uses fnAddData).

    Allan
  • emelianenkoemelianenko Posts: 18Questions: 0Answers: 0
    hello Alan

    thank you very much for answering. By the example you have quoted i can see that it goes in the direction I was refering to.

    What I mean is the following scenario. Say 3 interdependent select lists, country, province town. As you interact with them, a table below them is changing in real time (through Ajax calls, you dont even need to refresh page or press buttons) as it has a WHERE clause related to the 'id' of each select list. It is at this point that I would like to have it paginated. This table is actually the result of JOIN clauses of several other tables. However, in the example of Server Processing, reading the code, it says, "indicate the table you want to format" and you choose either "ajax" table or put any other of your db, but that is not a truly dynamic populating of results. I have been looking around and all of them seem to work on just one known table or an XML file.

    thank you very much
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Oh I see - so you want to basically have a DataTables showing the results from a database, with a specific filter applied to it, based on the select boxes. In which case, the easiest way to do it is to pass your search parameters to the server-side script link this: http://datatables.net/examples/server_side/custom_vars.html . Then you can alter the SQL statement on the server-side as needed, so it will respond with the data you want.

    You are right in saying that the example only considers one database table. However it can be modified to consider join's without too much difficulty. There is a discussion on that in this thread: http://datatables.net/forums/comments.php?DiscussionID=2774 .

    Allan
This discussion has been closed.