jQuery UI Widgets Forums Grid Trouble mapping to JSON date

This topic contains 0 replies, has 1 voice, and was last updated by  damerval 7 years, 2 months ago.

Viewing 1 post (of 1 total)
  • Author
  • Trouble mapping to JSON date #21293

    damerval
    Participant

    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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.