Hi,
Our date columns shows NaN-NaN-NaN for all rows in IE8 but the correct format in FF and IE11.
The Json sent to the grid is on the yyyy-MM-dd format and the column is of 'date' type and has its scheme and options.column data type set to 'date'.
Any help would be much appreciated!
Best Regards
Fredrik
Hi agian,
Here is some more information. I have been working all day now to try and figure this out. Seems like IE8 in general has an issue with Date.parse and dates on the format "yyyy-mm-dd". So I thought I would solve the problem by writing my own parser that overrides Date.parse for IE8 in particular but nothing calls is when I initialize and load the grid so I am back at square 0. Does infragistics override Date.parse? And in that case does it work for IE8? Or is there some other reason to why the date column shows up as NaN-NaN-NaN in IE8 but no other browsers?
Here is even more info.
If I comment the following two lines in the code below then the date column renders correctly but the date filter function does not. If I have the two lines uncommented then the date column does not render correctly but gets NaN-NaN-NaN but the date filter is correctly set.
schemaGenerated: generateSchema, columnsgenerated: generateColumns,
$("#dataGrid").igGrid({ schemaGenerated: generateSchema, columnsgenerated: generateColumns, dataRendering: gridRendering, autoGenerateColumns: true, defaultColumnWidth: "150px", width: "100%", dataSource: data, dataSourceType: "json", responseDataKey: "data", features: gridFeatures }); function generateSchema(evt, ui) { var nrOfColumns = ui.schema.fields.count(); for (var i = 0; i < nrOfColumns; i++) { var metadata = currentViewInfo.metaDataList[i]; ui.schema.fields[i].type = metadata.ColumnDataType; }}function generateColumns(evt, ui) { var nrOfColumns = ui.owner.options.columns.count(); for (var i = 0; i < nrOfColumns; i++) { var metadata = currentViewInfo.metaDataList[i]; ui.owner.options.columns[i].dataType = metadata.ColumnDataType; }}
$("#dataGrid").igGrid({ schemaGenerated: generateSchema, columnsgenerated: generateColumns, dataRendering: gridRendering, autoGenerateColumns: true, defaultColumnWidth: "150px", width: "100%", dataSource: data, dataSourceType: "json", responseDataKey: "data", features: gridFeatures });
function generateSchema(evt, ui) { var nrOfColumns = ui.schema.fields.count(); for (var i = 0; i < nrOfColumns; i++) { var metadata = currentViewInfo.metaDataList[i]; ui.schema.fields[i].type = metadata.ColumnDataType; }}function generateColumns(evt, ui) { var nrOfColumns = ui.owner.options.columns.count(); for (var i = 0; i < nrOfColumns; i++) { var metadata = currentViewInfo.metaDataList[i]; ui.owner.options.columns[i].dataType = metadata.ColumnDataType; }}
Hello Fredrik, F2O,
I want to share with you some good news.
We decided to implement a solution of this IE 8 behavior in our codebase for the next Ignite UI SR.
Best regards,
Martin PavlovInfragistics, Inc.
Hello Fredrik,
It took me a little time and now it works.
Thanks for your very useful help!
Best Regard.
F2O
Hi F2O,
We are using the igDatePicker. However we are using column templates and we loop each column and set its properties when we bind data to the grid. Something like this:
cols[i].key = metadata.ColumnKey; cols[i].hidden = metadata.ColumnHidden; cols[i].headerText = metadata.ColumnText;cols[i].format = metadata.ColumnFormat;cols[i].template = metadata.ColumnTemplate;
Where the format determines the date format for a date column and the template determines whether or not a color should be set for dates more than X etc.
Thank you for your reply. I think the 2nd option is better.
Do you use a igDatepicker or igDateEditor?
Because I am using a rowEditTemplate, so a date must be able to be picked in a calendar... When it is formatted in String, how display it in a igDatePicker?
We chose to go with the second option because it is overall safer and if you allow different date formats your web frontend doesn't have to worry about them. Personally I do not like overriding or appending behavior to javascript prototypes. If your backend is C# then you should handle all your dates as datetime objects and it should hence not be that long of a stretch to format them as milliseconds since 1970-01-01 and then specify the format for how to display the date in the web layer. In order to get the grid to display your date all you have to do is give it the time in milliseconds and a format string. However some date formats seems to be invalid for some reason. For e.g. dd-MMM-yyyy.
Best regards