Mar 06, 2014, 4:30 PM
Ext.Net MVC 3 - JsonResult Issue
Hi,
I have this button:
Could somebody please explain to me how to read the jsonresult properly?
Thank you
I have this button:
var btnIntelisis = x.Button()
.Icon(Icon.Magnifier)
.DirectEvents(de=>
{
de.Click.EventMask.ShowMask = true;
de.Click.Url = Url.Action("Method", "Controller");
de.Click.ExtraParams.Add
(
x.Parameter()
.Name("param1")
.Value("App.TextField.getValue()")
.Mode(ParameterMode.Raw)
);
de.Click.ExtraParams.Add
(
x.Parameter()
.Name("param2")
.Value("App.TextField2.getValue()")
.Mode(ParameterMode.Raw)
);
de.Click.Success = "Ext.Msg.show({ title:'Title', " +
"msg: result, buttons: Ext.Msg.OK, icon: Ext.Msg.INFO });";
de.Click.Failure = "Ext.Msg.show({ title:'Error', " +
"msg: 'Error', buttons: Ext.Msg.OK, icon: Ext.Msg.ERROR });";
});
But I'm having an issue reading the json result response on client side in the success action of the DirectEvent. I have this code in the success: de.Click.Success = "Ext.Msg.show({ title:'Encontrado', msg: Ext.decode(result.data), buttons: Ext.Msg.OK, icon: Ext.Msg.INFO });";
Also tried with this but nothing happened:de.Click.Success = "Ext.Msg.show({ title:'Encontrado', msg: Ext.decode(result.data), buttons: Ext.Msg.OK, icon: Ext.Msg.INFO });";
If I try with this the window appears but the message says "[object Object]:de.Click.Success = "Ext.Msg.show({ title:'Encontrado', msg: result, buttons: Ext.Msg.OK, icon: Ext.Msg.INFO });";
If I try with this, the window appears but the message is empty:de.Click.Success = "Ext.Msg.show({ title:'Encontrado', msg: result.data, buttons: Ext.Msg.OK, icon: Ext.Msg.INFO });";
This is the json response from controller (read from Fiddler):data=[{"_idstudy":"10333909","description":"TEXT","performance":0.00,
"abbreviation":"TEXT'","clave":"SOME CODE","category":"TEXT","provider":"CODE",
"family":"TEXT","manufacturer":"SIEMENS MEDICAL S.","price":287.62,"status":true}]
I need to know how to read the jsonresponse properly to link the data with a formpanel to show it to the users. I've trying some opinions in the forums and other pages like Ext.util.JSON.decode(result.data), Ext.util.JSON.decode(result) unsuccessfully.Could somebody please explain to me how to read the jsonresult properly?
Thank you
Last edited by Daniil; Mar 07, 2014 at 8:14 AM.