[CLOSED] passing data from controller to 'RemoteActionSuccess'

  1. #1

    [CLOSED] passing data from controller to 'RemoteActionSuccess'

    Dear Support Members,

    on listner 'RemoteActionSuccess' e.message does not work rather it works with RemoteActionRefusal when i set success=false.
    <RemoteActionRefusal Handler="Ext.Msg.alert('Error', e.message);" />                             
                    <RemoteActionSuccess Handler="Ext.net.Notification.show({
                                        title:'Success',
                                        html:e.message
                                        });" />

    and in controller
    JsonResult result = new JsonResult();
    result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
    result.Data = new
    {
    d = new
    {
    success = true,
    message = "Operation Succeeded"
    }
    };
    
    return result
    Last edited by Daniil; Nov 18, 2011 at 5:39 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Yes, it's a problem: additional things in a response are not accessible in a success handler.

    Thanks for the report. We are investigating a fix.
  3. #3
    The bug ticket has been created.
    https://extnet.lighthouseapp.com/pro...26/tickets/220

    The problem has been fixed, the last SVN revision is #3774.

    Now when a TreePanel remote mode deals with a WebService or MVC controller action,
    an "actionSuccess" parameter instead of "success" one must be sent.

    Here is the example.

    Example View
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET.MVC Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" ShowWarningOnAjaxFailure="false" />
            
            <ext:TreePanel 
                ID="TreePanel1"
                runat="server" 
                Height="300" 
                Width="250"
                EnableDD="true"
                Mode="Remote"
                RootVisible="false"
                RemoteJson="true"
                RemoteMoveUrl="/Test/RemoteMove"
                RemoteAppendUrl="/Test/RemoteAppend">
                <Loader>
                    <ext:TreeLoader DataUrl="/Test/GetNodes" Json="true" />
                </Loader>
                <Root>
                    <ext:AsyncTreeNode NodeID="0" Text="Root" />
                </Root>
                 <Editors>
                    <ext:TreeEditor runat="server">
                        <Field>
                            <ext:TextField runat="server" />
                        </Field>
                    </ext:TreeEditor>
                </Editors>
                <Listeners>
                    <RemoteActionRefusal Handler="Ext.Msg.alert('Refusal', responseParams.message);" />
                    <RemoteActionSuccess Handler="Ext.Msg.alert('Success', responseParams.message);" />
                </Listeners>
            </ext:TreePanel>
            <ext:Button runat="server" Text="Append">
                <Listeners>
                    <Click Handler="TreePanel1.appendChild(TreePanel1.root.childNodes[0], '');" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Example Controller
    using System;
    using System.Web.Mvc;
    using Ext.Net;
    using Ext.Net.MVC;
    
    namespace Mvc.Controllers
    {
        public class TestController : Controller
        {
    
            public ContentResult GetNodes(string node)
            {
                TreeNodeCollection nodes = new TreeNodeCollection(false);
    
                string prefix = DateTime.Now.Second + "_";
                for (int i = 0; i < 10; i++)
                {
                    Ext.Net.TreeNode newNode = new Ext.Net.TreeNode();
                    newNode.NodeID = i.ToString();
                    newNode.Text = prefix + i;
                    newNode.Leaf = true;
                    nodes.Add(newNode);
                }
    
                return Content(nodes.ToJson());
            }
    
            public JsonResult RemoteMove()
            {
                JsonResult r = new JsonResult();
                r.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                r.Data = new
                {
                    d = new
                    {
                        actionSuccess = false,
                        response = new
                        {
                            message = "RemoteMove"
                        }
                    }
                };
    
                return r;
            }
    
            public JsonResult RemoteAppend()
            {
                JsonResult r = new JsonResult();
                r.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                r.Data = new
                {
                    d = new
                    {
                        actionSuccess = true,
                        response = new
                        {
                            message = "RemoteAppend"
                        }
                    }
                };
    
                return r;
            }
        }
    }

Similar Threads

  1. Replies: 1
    Last Post: Jul 02, 2012, 6:19 PM
  2. Replies: 6
    Last Post: Apr 25, 2012, 11:05 AM
  3. [CLOSED] passing ext.net controls to controller function
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Feb 16, 2012, 12:55 PM
  4. [CLOSED] Store: Passing JSON data directly to Server-Side
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 09, 2012, 2:08 AM
  5. Passing data between different 2 Stores
    By titombo in forum 1.x Help
    Replies: 0
    Last Post: Jul 15, 2011, 8:54 AM

Posting Permissions