Hi,
I am having trouble mapping to a JSON date. I have a grid which displays data from a query. This is a typical record of this data:
{“ofndr_num”:”599360″,”intake_date”:{“date”:”2012-01-15 00:00:00″,”timezone_type”:3,”timezone”:”UTC”},”first_name”:”XXXXXXXXXX”,”last_name”:”XXXXXXXXXX”,”highest_crime”:”UNKNOWN MISDEMEANOR”,”assign_reason”:”ARRESTED\/REMANDED”}
Note the nested JSON intake_date field.
I bind this data to my grid through the source, like this:
var source = {
datatype: “json”,
datafields: [
{name: ‘ofndr_num’, type: ‘number’}, {name: ‘intake date’, type: ‘date’, map: ‘intake_date>date’}, {name: ‘first_name’}, {name: ‘last_name’},
{name: ‘highest_crime’}, {name: ‘assign_reason’}
],
url: ‘data.php’
};
And I create my grid with columns defined as follows:
columns: [
{text: ‘Off. #’, datafield: ‘ofndr_num’, width: 75}, {text: ‘Arrived on’, datafield: ‘intake_date’, cellformat: ‘d’, width: 100},
{text: ‘First name’, datafield: ‘first_name’, width: 100},
{text: ‘Last name’, datafield: ‘last_name’, width: 125}, {text: ‘Crime’, datafield: ‘highest_crime’, width: 200},
{text: ‘Action’, datafield: ‘assign_reason’, width: 150}
]
However, when I view the grid, there is no data in the cells for the intake date column. The header correctly shows “Arrived on”, but there is nothing in the corresponding rows.
Please help me figure out what I am missing. Thank you!
Philippe