Combining database tables in server-side datatables
Combining database tables in server-side datatables
So, I am inheriting an intranet site that was built on datatables. Basically it is made in Wordpress and then displays custom fields that the users have filled out in the datatable. But it was querying 40 columns per post over 2k entries so is now grinding to a standstill when the users try and view the data in the table.
I'm attempting to utilize the server-side aspect of Datatables for this, but running into a little trouble because of how the sql data is formatted.
Can anyone offer any assistance in how to set up the server_processing.php file to:
1. Display rows based on the wp_posts.ID index
2. Display columns in this row based on a different table (wp_postmeta) wherein each column value is indexed separately in the wp_postmeta table by the ID found in 1
3. Link entire row to a url found in the wp_posts table
If anyone has any ideas I would really appreciate it, and if I can pay for support to this query let me know and I will gladly (I was just unsure if this was an avenue you do actually support). Thanks so much.
I'm attempting to utilize the server-side aspect of Datatables for this, but running into a little trouble because of how the sql data is formatted.
Can anyone offer any assistance in how to set up the server_processing.php file to:
1. Display rows based on the wp_posts.ID index
2. Display columns in this row based on a different table (wp_postmeta) wherein each column value is indexed separately in the wp_postmeta table by the ID found in 1
3. Link entire row to a url found in the wp_posts table
If anyone has any ideas I would really appreciate it, and if I can pay for support to this query let me know and I will gladly (I was just unsure if this was an avenue you do actually support). Thanks so much.
This discussion has been closed.
Replies
However, server-side processing is certainly a good option for large tables. It sounds like you want to do a join in the script - there is an example server-side processing script that does a join here: http://datatables.net/dev/server_processing.txt
> 3. Link entire row to a url found in the wp_posts table
Attach a jQuery 'click' event listener to the row which will use fnGetData on the row and then set window.location.href as required.
Regards,
Allan