Ext.Net MVC 3 - JsonResult Issue

  1. #1

    Ext.Net MVC 3 - JsonResult Issue

    Hi,

    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.
  2. #2
    For DirectEvent you have to use DirectResult only
  3. #3
    Quote Originally Posted by Vladimir View Post
    For DirectEvent you have to use DirectResult only
    Thank you Vladimir, I had to change the way how to read the response data, I had to fill out the formpanel from the controller, you can mark this issue as closed.

Similar Threads

  1. [MVC3] How to get JsonResult to Combobox
    By delta in forum 2.x Help
    Replies: 0
    Last Post: Jan 12, 2013, 1:51 AM
  2. Replies: 3
    Last Post: Dec 05, 2012, 1:38 PM
  3. [CLOSED] Pecilluar issue in the DropDown, UI Issue
    By Shanth in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 22, 2012, 12:02 PM

Tags for this Thread

Posting Permissions