number format

how can i when initialization is from HTML use this format :

mygrid.setNumberFormat(“0,000.00”,index,",","."); //(Russian)
1456.789 => 1.456,78

The column format can be defined right in the header of your table.
For example:

<table id="tblToGrid" name="grid" style="width:400px; height:400px" imgpath="codebase/imgs/" border="1" onbeforeinit="doBeforeInit()" oninit="doAfterInit()"> <tr> <td type="coro" style="background-color:#98A709;"><div >Column 1</div></td> <td type="edn" format="0,000.00">Column 2</td> </tr> ...

Hi Sematik,

thx for reply but I known this process so far… my problem is I can’t apply any option like decimal separator…

the setNumberFormat method is simply ignored and I don’t find the syntax to apply options to your suggestion

best regards

functions like setInitWidthsP, setColSorting, setColTypes work perferctly with a table from HTML
not the case for setNumberFormat… :angry:

use format in the td tag works indeed but without the precious options :exclamation: :question:

The following code works well for us.

[code]

















Column 1 Column 2
11 112.5
11 14.15
11 85
[/code]

<script> mygrid = new dhtmlXGridFromTable('tblToGrid'); function doBeforeInit(){ grid.setNumberFormat("0,000.0",1,".",","); } </script>

it works that way…

thx a lot Sematik

Hi support team; me again…

grid.setNumberFormat(“0,000.0”,1,".",","); works but in Excelle, the column is no more consider as number but like text (no sum possibles for example) … have you a solution for this ?

best regards

Unfortunately such issue cannot be solved.
The only way is to convert the value to a num manually when you need some operations with it.

something for the 4.0 version ? :slight_smile:

thx for your answer Sematik