I am attempting to use the parse function as described in the docs here:
http://docs.kendoui.com/api/framework/datasource#configuration-schema.parse-Function
I'm trying to convert a field in my data to a date like so:
parse: function(data) {
for(var i = 0; i < data.length; i++){
data[i].CreatedDate = new Date(data[i].CreatedDate);
}
return data;
}
However if I put a breakpoint on the line "return data" and inspect the data object, all of the CreatedDate properties are still strings. I tried various things before checking the property descriptor and finding that writable is false. I checked the property descriptor like so:
Object.getOwnPropertyDescriptor(data[0], "CreatedDate");
and the output was:
{
configurable: false,
enumerable :true,
value: "Mon Oct 13 1975 11:13:00 GMT+1000 (E. Australia Standard Time)",
writable: false
}
So no matter what changes I tried to make in the parse function, nothing would persist. I even tried data[i].CreatedDate = null so I know it hasn't got anything to do with converting strings to dates.
I created a quick jsbin.com but I couldn't replicate the result (so I don't see a point in including it here)- the property descriptors were writable = true. I'm not sure why the code in my icenium project is causing writeable to be false and I don't even know where to look to try and figure this out. It may have nothing to do with it but my data-source transport is reading from an SQLite database (unlike my jsbin test that used a local array), the code of which is based on the SQLite example project I found in icenium.
Any help would be much appreciated.
http://docs.kendoui.com/api/framework/datasource#configuration-schema.parse-Function
I'm trying to convert a field in my data to a date like so:
parse: function(data) {
for(var i = 0; i < data.length; i++){
data[i].CreatedDate = new Date(data[i].CreatedDate);
}
return data;
}
However if I put a breakpoint on the line "return data" and inspect the data object, all of the CreatedDate properties are still strings. I tried various things before checking the property descriptor and finding that writable is false. I checked the property descriptor like so:
Object.getOwnPropertyDescriptor(data[0], "CreatedDate");
and the output was:
{
configurable: false,
enumerable :true,
value: "Mon Oct 13 1975 11:13:00 GMT+1000 (E. Australia Standard Time)",
writable: false
}
So no matter what changes I tried to make in the parse function, nothing would persist. I even tried data[i].CreatedDate = null so I know it hasn't got anything to do with converting strings to dates.
I created a quick jsbin.com but I couldn't replicate the result (so I don't see a point in including it here)- the property descriptors were writable = true. I'm not sure why the code in my icenium project is causing writeable to be false and I don't even know where to look to try and figure this out. It may have nothing to do with it but my data-source transport is reading from an SQLite database (unlike my jsbin test that used a local array), the code of which is based on the SQLite example project I found in icenium.
Any help would be much appreciated.