In my understanding, an Ext JS form panel wants the following input:
{
'success': true,
'data': {
'name-field': 'Boogie',
'number-field': '789789',
'application-field': 'CE',
'brand-field': 'GE',
'clientreport-field': '1',
'moneyreport-field': '1',
'billingreport-field': '1',
'auditreport-field':'1'
}
}";
But the following ASP.NET MVC controller:
public ActionResult FormLoader(string id)
{
var result = repoS.GetClientSetting(id);
return Json(new {success = true, data = result}, JsonRequestBehavior.AllowGet);
}
Returns the following output:
{
"success": true,
"data": [
{
"ID": 3,
"Name": "Forngap",
"Number": "lipo-900",
"Application": "EA",
"Brand": "6.7.8",
"ClientReport": false,
"MoneyReport": false,
"BillingReport": false,
"AuditReport": false,
"Login": "eeporp",
"Password": "ungah",
"Active": false
}
]
}
With an extra set of “[ ]” around the “data” array. Can the controller above return what Ext JS forms want? Or does this require something besides Json? Thank you!
it seams that:
returns array with 1 needed element, so try to pass only first element to
data:not sure is it correct syntax ( not working with ASP.NET )
or when loading data to form send first element of array data
however fixing output would be better way