PDA

View Full Version : Questions regarding fields in medaData



webpastor
26 Jan 2010, 12:39 PM
I'm receiving the following Json data from the server and loading it into a JsonStore. As you can see the fields section in the metaData is pretty plain. There is no defining of data types and no dataFormat thus the expense_date field is being treated as a string.



{
"metaData":{
"root":"data",
"totalProperty":"rows",
"successProperty":"success",
"fields":[
{
"name":"id"
},
{
"name":"parent_id"
},
{
"name":"expense_date"
},
{
"name":"cost_center"
},
{
"name":"amount"
},
{
"name":"item_number"
},
{
"name":"item_description"
},
{
"name":"additional_comments"
}
],
"start":0,
"limit":10
},
"data":[
{
"id":"-9223372036854343278",
"parent_id":"-9223372036854345457",
"expense_date":"2010-01-01",
"cost_center":316,
"amount":42.52,
"item_number":73403,
"item_description":"CELL-PAGER-FIELD",
"additional_comments":""
},
{
"id":"-9223372036854345451",
"parent_id":"-9223372036854345457",
"expense_date":"2010-01-07",
"cost_center":2699,
"amount":36.95,
"item_number":64300,
"item_description":"OFFICE SUPPLIES & POSTAGE",
"additional_comments":""
}
],
"rows":2,
"success":true
}


Is there a way "on the client side" to redefine the fields section to the following? Or do these setting have to come from the server?


{name: 'id', type: 'string'},
{name: 'parent_id', type: 'string'},
{name: 'expense_date', type: 'date', dateFormat: 'Y-m-d'},
{name: 'cost_center', type: 'int'},
{name: 'amount', type: 'float'},
{name: 'item_number', type: 'int'},
{name: 'item_description', type: 'stirng'},
{name: 'additional_comments', type: 'stirng'}


Any help would be appreciated