How to display table data by column field value?
How to display table data by column field value?
All, I have a table that uses server-side processing to display results. It works superbly as it is, but I want to add the ability to show only the data that belongs to the logged on user.
Here's the deal. I have everything all set up for it in Mysql, and on my site. When the user logs in, and posts data, that data is recorded along with their uid in a mysql table. So there's actually a column for their uid in the table in question.
In PHP it's pretty simple to form a sql query that includes the SQL "WHERE" syntax to get only that user's data.
And I know how to get the ID of the currently logged in user in Drupal (which I'm using) which is (i think):var uid = Drupal.settings.currentUser;
How do I do the same thing with datatables? Been looking around, but I'm not sure what search terms to even use to find this information.
Thank you!
-S
Here's the deal. I have everything all set up for it in Mysql, and on my site. When the user logs in, and posts data, that data is recorded along with their uid in a mysql table. So there's actually a column for their uid in the table in question.
In PHP it's pretty simple to form a sql query that includes the SQL "WHERE" syntax to get only that user's data.
And I know how to get the ID of the currently logged in user in Drupal (which I'm using) which is (i think):var uid = Drupal.settings.currentUser;
How do I do the same thing with datatables? Been looking around, but I'm not sure what search terms to even use to find this information.
Thank you!
-S
This discussion has been closed.
Replies
http://drupal.org/node/828916
Make sure that javascript line is put in your javascript code obviously. Next do this:
oTable.fnFilter( uid, 3);
where the "3" is your column number. You must have a 3rd column returned from your server processing script, and also defined in your HTML table. If it's a user ID, might be smart to hide that row too.