This small jQuery plugin was written to solve a small problem in one of our project. Thought I should share this.
We had a table and the data for the table was fetched with AJAX calls. The server would return us the data in JSON and this data would be populated in the table. We had to highlight the content of the data as per the “goodness value”. That means, if the data in certain field was ‘ok’ then we had to highlight it light orange and if it was ‘excellent’ we had to highlight it dark orange.
A rather simple way of doing this would be assigning a class for these cells that needs to be highlighted but because the data that was coming from the server was JSON and we could not attach such class in the JSON data, we had to follow another approach.
So we wrote this jQuery based plugin which would traverse through the table and highlight these data as required. It would only act on defined column number while highlighting the data. In above case the column number would be 2.
Also the highlight color can be changed while calling the plugin.
You can see the demo of this plugin here.