Is price type cells always displayed green?


If the column type is “price”, why the font color for the price value is always green?

Even if I try to set font color (in a css style) for a cell to a different color it still print it green!


this will render the dollar sign ($) red but the price value is still rendered green!

Any idea why and how we can change it?


Actually it is part of design, column shows positive data in green, and negative ( or incorrect ) in red.

dhtmlxgridcell.js, line 1087

eXcell_price.prototype.setValue = function(val){
        var color = “green”;
        if(val<0) color = “red”;

I can’t see why this needs to be part of the design and not a configurable feature?

Forcing particular font color is unusual for general purpose component and styles are meant to address the look and feel issue. I hate to go an dhack the code because I could easiliy lose it in the next code release.

If something likethis is desirable and already established in the code then we should at leastbe able to override it like grid.enablePriceDefault(true/false) an dhave a call back method to handle the price look&feel.

The excells used in grid are dynamically created object, it possible to create new excells ( actually this is the best way to provide custom formating|edit|validate capabilities )
The “price” excell was initially created just as a sample of excell possibility, it has no sense to add a bunch of options to each excell, while with few lines of code it possible to create a new excell type with necessary behavior.

Basically  you need not to change anything in code, because you can create your custom excell type and use it instead of standard one

function eXcell_priceA(cell){
    this.base = eXcell_price;
eXcell_priceA.prototype = new eXcell_price;
eXcell_priceA.prototype.setValue = function(val){

now you can use priceA , which works the same as price but without color formatting.

Perfect answer! Thank you very much!