serverDateFormat using Grid,Form, DataStore & DataProcessor

Hi,

I know there is tons of messages about this issue here in the forum. Still I could not solve the issue.

I use a Grid, a Scheduler and a Form all bind to a DataStore & DataProcessor:

myForm.bind(myDataStore); myGrid.sync(myDataStore); dmScheduler.sync(myDataStore);

The date format and server date format is set:

[code]myGrid.setDateFormat(“%d.%m.%Y”);
myGrid.setColTypes(“…,dhxCalendarA,…”);


myForm:
{
type:“calendar”,
name:“start_date”,
validate:“NotEmpty”,
dateFormat:“%d.%m.%Y”,
serverDateFormat:“%d.%m.%Y”,
label:“Datum”,
offsetTop:7
},
[/code]

Like mentioned in other threads I overwrite form.getValues:

myForm.getValues = function() { return this.getFormData(true, true); };

Everything is displayed correctly.

myForm.getValues() → returns end_date: “04.02.2015”

but even after a myForm.save();

myDataStore.item(rowid) → returns: start_date: Wed Feb 04 2015 00:00:00 GMT+0100 (CET)

which is also sent via the dataprocessor when I send the data:

myDataProcessor.init(myDataStore); myDataProcessor.sendData(rowid);

What do I miss? How do I tell the DataStore/DataProcessor the correct serverDateFormat?

Thank you
Karl

typo at the end: end_date should be start_date

so it is the same variable, just a copy & paste bug. sorry.

Hi,

Which version of dhtmlx suite you are using ?
I will try to reconstruct the issue locally, but so far code looks correct and must store date as string.

I’m using the “latest” release 4.1.2

Hi
Locally it works fine.
Please, provide us completed demo on support@dhtmlx.com with a link to this topic
docs.dhtmlx.com/auxiliary_docs__ … pport.html

Hi,

I don’t know what I changed but it it is working now :slight_smile:

Follow-up question:

In my Forms I use the following setup for the date format:

	dateFormat:"%d.%m.%Y",
	serverDateFormat:"%Y-%m-%d",

Which works fine.

Is there something alike for a Grid Column? Since I use the same DataStore my ServerDateFormat is “fixed” but I need to display the column in the local format.

Thank you very much
Karl

You can use setDateFormat as

mygrid.setDateFormat("%d.%m.%Y");

or

mygrid.setDateFormat("%d.%m.%Y", "%Y-%m-%d");

First parameter is used for data rendering, second - for data parsing.

Dear Stanislav,

great works fine.

General feedback: This should be added to the documentation. Too many features are not documented and like this cause work on both sides.

Thank you very much
Karl