Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by klaus becker on May 19, 2008 00:58
open dhtmlx forum
Custom Date Format

Hello

I'm new at dhtmlxGrid and so I have a question about setting a custom date format.
I tried to load data from a HTML table
like
<tr>
<td>value 11</td>
<td>12</td>
<td>10/12/2008</td>
</tr>
and I call following code to init it,
but it doesn' work
var aGrid = new dhtmlXGridFromTable('tblToGrid');
aGrid.setColSorting("str,int,date");
aGrid.setColTypes("ro,ro,calendar");
aGrid.setDateFormat("d.m.y");

Is the date input format wrong?
Any other wrong code in my example?

Kind Regards
Klaus
Answer posted by Support on May 19, 2008 07:32

When loading data from HTML , you need to define format as part of HTML table, in other case it will be applied to late.

 

<table forceCellTypes="true" ...
<tr>
<td>Header A</td>
<td>Header B</td>
<td format="d.m.y">Header C</td>
</tr><tr>
<td>value 11</td>
<td>12</td>
<td>10/12/2008</td>

Answer posted by klaus on May 19, 2008 21:27
sorry, but it doesn't work anyway.

We are using the evaluation package of dhtmlxTreeGrid v.1.5 Professional.
So I hope that this function will be supported at this version because
I haven't anything found at the js file (dhtmlxgrid_start.js).
Would it be possible to send us a complete example?

We also need the possibility to format the numbers with
"," as decimal part separator and
"." as groups separator.
Everything must work by loading from a html table!!!

Kind Regards
Klaus
Answer posted by Support on May 20, 2008 05:48
Please try to use attached js file instead of original one - with it format options will be available for both calendar and numeric cells.

>>We also need the possibility to format the numbers with
    http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Cell_values_formating.html#grid_art_formatcells
Attachments (2)
Answer posted on May 20, 2008 23:59

thx

the date format now works well but

the number format doesn't work as needed

because we need "0.000,00" instead of "0,000.00"

another bug in your example was that forceCellTypes="true" has been missing.

Answer posted by Support on May 21, 2008 06:20

>>because we need "0.000,00" instead of "0,000.00"

It can be set only through setNumberFormat  command, can't be set from HTML

  http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Cell_values_formating.html