I have a grid with 2 columns which I am using to simulate a ‘Form’. The grid is initialised using XML. So Col 0 holds the desc of the field and Col 1 holds the data. I can get different cell types for each row. However I want to have different Number formats as well. e.g. Some rows hold an integer value whilst others hold decimal values. How can I set Number formats for different rows or cells rather than just for a Column?
There is no way to set different number format for different cells in one column using setNumberFormat() method.
As a workaround you can pass formatted value with XML.
Thanks for your reply Olga. Unfortunately because the formatted value is a number it is formatted using the Number format of the column. I sent a ‘0’ which displays as ‘0.00’.
This is expected behavior. If column has number format, all values in this column will be formated.
If you want only few cell at the column to be formatted, you can set column type as “ed” and set “edn” type only for those cells:
After I have done what you suggest then if I put a number format on the column will the cells with ‘edn’ follow the formatting? If that is the case then I can get what I want.
“ron” type is a read-only eXcell with formatting capabilities that allows specific formatting through grid.setNumberFormat. it designed to display numbers. If you have not-a-number in your cell you may try to set the the type of this cell to “ro” to display the value without any formatting.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan