Hi all,
I just found DataTable and it's proving very easy and useful. I have a couple internal webpages at work, displaying information in tables, and my boss has been asking me to make the tables sortable. I finally looked into it today, and after finding this plugin, my tables were sortable in about ten minutes!
There's one problem I'm having, though. The main webpage where I'm applying this shows a table of requests. Staff can approve a request, own it (to indicate to other staff that this user has it covered) or both. When a request is not approved, it has a red background with light red text; when it is owned and unapproved, it has a yellow background with black text; when it is approved, owned or not, it has a dark green background on light green text. Some requests are informational and don't need approval, and these are gray.
Here's the problem. The moment I enabled DataTable, my text colors stayed the same, but my rows all got a white background. I don't know why this is happening, especially since my text didn't change color. I'm guessing DT applies a default background color, but I don't know how to tell it not to. I like the lines between rows, but I want my own colors to override whatever DT does.
In case it matters, you should also know that this page is heavy on ajax. The table itself is created inside the pages' backend file (written in PHP), then placed on the page. Whenever a user changes a request's status, there's no button to apply the change, it happens when the checkbox is clicked. The same PHP file that makes the whole table will get the data, update the database, then return a TR element that Jquery uses to replace the existing one. This is why colors are important to me; when a user approves a request, the row needs to turn green, and when a user is looking at all requests, it needs to be obvious which are not yet approved or owned.
My colors are assigned in CSS, not through style tags. In the PHP file that makes the table, I assign a class of "red", "green", and so on based on values found in the database row on which the current table row is based. My CSS simply defines what classes of various colors should look like.
Hopefully I'm making sense, and have given enough information. If anyone needs more details, let me know. Apart from this, my tables are working perfectly, so I'd love to get this final loose end tied up. Thanks for any suggestions.