How to change default from 1969-12-31 to current date?

Hi, for null values in my database table, I see “1969-12-31” in my data grid. How can I change it to the current date? Where is “1969-12-31” specified? Thanks!

Hello,

today’s date is default for the dhxCalendar excells:

dhtmlxGrid/samples/01_cell_types/01_calendar_grid.html (the second column)
dhtmlx.com/docs/products/dht … _grid.html

I tried “dhxCalendar” and “dhxCalendarA” - in my java server code, I have “type=‘dhxCalendar’” as part of the column definition. But both default to 1969-12-31 when I double-click on the column. I use following command to set format in Java code:

<beforeInit><call command='setDateFormat'><param>%Y-%m-%d</param></call></beforeInit>

Seems to me it is the same as the link you sent:

mygrid.setColTypes("ed,dhxCalendar,dhxCalendarA");

The only difference is this is done in javascript but my code is in java. Could you be more specific about how I can set the default to today’s date? Thanks.

Hello,

what grid version are you using? The problem doesn’t occur in the 2.6 version:

dhtmlx.com/docs/products/dht … _grid.html

I was using 2.5 pro version. Today I tried 2.6 pro, but it didn’t make a difference. In both cases, I used ‘dhtmlx.js’, not the separate scripts. If I include ‘dhtmlxgrid.js’ after ‘dhtmlx.js’, my grid doesn’t work anymore.

The issue should be pretty easy to replicate - any further help is appreciated. Thanks!

Today I tried 2.6 pro, but it didn’t make a difference

Is the problem reproduced in the sample dhtmlxGrid/samples/01_cell_types/01_calendar_grid.html ?

Which version are you going to use 2.5 or 2.6 ? Why did you include dhtmlxgrid.js after ‘dhtmlx.js’ ?

I have been using 2.5 since the beginning of the project, so I would like to stick to it (although for my application, 2.6 seems to work the same as 2.5 as far as I can tell).

I don’t need to add ‘dhtmlxgrid.js’ - I was just trying to see if that would help. It did not.

I tried your sample code and was able to reproduce the problem - it’s crucial that we distinguish two different things: an empty field or a NULL field. The calendar defaults to today’s date if the field is like this:

<cell></cell>

But defaults to 1969-12-31 if the cell is like this:

<cell>null</cell>

Actually it doesn’t matter whether the string is “null” or “foo”, it defaults to 1969. I would really appreciate your help if we can set the default to today’s date. Thanks!

Grid expects the valid date object or empty value as a cell value. The problem is not reproduced in case of . Am I right ?

If you need to modify the calendar value, you may set onCalendarShow event handler it takes calendar object, the id of grid cell and cell index:

grid.attachEvent(“onCalendarShow”,function(calendar,rId,cIndex){
var value = grid.cells(rId,cIndex).getValue();
/your code here/
})

Calendar date can be set by setDate method.

It worked - thank you for the help. I didn’t setDate() on calendar; instead, i just set the cell to empty string:

grid.cells(rId,cIndex).setValue("");