I generally don't like using Excel and Microsoft products in general, but Excel 2007/2010 has some very nice conditional formatting features which, sadly, I haven't seen in many other places so far. One of these which I use extensively in business reports is data bars. http://blogs.msdn.com/b/excel/archive/2009/08/07/data-bar-improvements-in-excel-2010.aspx
In my opinion, these data bars are extremely helpful in understanding the meaning of data beyond the numbers. While the difference between 200 and 2000 users is just a hard-to-grasp digit to the human eye, a bar which is 10 times longer is much more intuitive.
My question: Is there any way to include in-cell conditional data bars for every value of a column in jqGrid, mirroring the Excel functionality? This would be the only way I see to get rid of our Excel sheets and implement the reports in an online reporting system. Data bars are simply indispensable once you get used to them, and they are the only reason we still use Excel for reports.
If, as I assume, there is no built-in functionality like this in jqGrid, do you think it would be a lot of work to custom-build it? Do you have any ideas what the best way would be to approach this?
It is an interesting feature of Excel about which you wrote in your question. I haven't known about this before.
What you need is to implement a custom formater function. In general is is very easy. You should write a small function which display the cell contain based on the value (text over the color bar). Moreover you should define also Unformatting custom function which will be very easy in your case. The unformating function could be used during sorting and other jqGrid operation where one need get the value from the grid cell.
So your problem could be reduced to displaying the number over the color bar.
UPDATED: I though again and again about your question because I find that the usage of colors for formating of numbers could be really helpful. So I spend some time and created the corresponding code example which produce following results
and can be seen live here.
Small comments to the code. I had to create some CSS classes which produce gradient bar in any current browsers excepting Opera where the grid are seen as
The CSS classes are defined as following:
and the jqGrid code inside of
$(document).ready(function () {/*code*/});
:UPDATED: The actualized version of the demo is here.
I think it's possible, but with a little planning and a few assumptions.
Assumptions:
If you have a numeric column with a width of lets say 100px, then make a pre determined decision to have 10 possible data bar widths. (0, 10px, 20px, .... 100px). Each of these can be saved as images, You can have your nice gradient end bit too :)
Lets call them 0.png, 10.png, 20.png, .... 100.png
Now the approach would be something along these lines: