Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Gabi on Jun 12, 2008 04:46
open dhtmlx forum
Custom numeric format

I need the excell_edn type to show colors ( with ups and downs - optional )

red - < 0
green - > 0

and i need the sum function to work with comma's ( when i sum up values like: 1,200 + 1,400 ... it shows up NaN )

thank you.
Answer posted by Support on Jun 12, 2008 06:56
The existing number formatting functionality not allows to define cell colors based on values, but you can use onCellChanged event for such purpose

grid.attachEvent("onCellChanged",function(id,ind,value){
    grid.cells(id,ind).cell.className=(value<0)?"redOne":"greenOne";
})

>>and i need the sum function to work with comma's
To work correctly with numeric values you need provide them in default format 1,200 => 1200 without group separation string, in such case they will be correctly calculated by any math.
To achieve necessary formatting you can use
    grid.setNumberFormat("0,000",index)
In such case the inner representation of number will be correct, but rendered data look as necessary in your case.
Answer posted by Gabi on Jun 18, 2008 06:29
Thank you. This is working.

But when i apply a freeze at the first column ( splitAt(1) )
I get the following error:

c has no properties

var c = this.getRowById(row_id);var cell = (c._childIndexes ? c.childNodes[c._c...

 

 




Answer posted by Support on Jun 18, 2008 09:25
The approach with onCellChanged event will not work in split mode, in such case the custom formatting can be done by custom excell only.