[CLOSED] Set complex objects to custom config value during direct event

  1. #1

    [CLOSED] Set complex objects to custom config value during direct event

    Hello,

    I have custom config definitions for a viewport and I can set complex values (Dictionary object, List etc.) during page load as below:

    code behind:

    MyViewport.Set("MyCustomConfig", MyDictionary);
    It works fine during page load.

    How can I re-set "MyCustomConfig" in a direct event call? MyViewport.Set("MyCustomConfig", MyDictionary) has no effect.

    I tried using MyViewport.AddScript("App.MyViewport.MyCustomConfi g = {0};", MyDictionary) but it does not work.

    Any idea?

    Thanks.
    Last edited by Daniil; May 22, 2013 at 3:52 PM. Reason: [CLOSED]
  2. #2
    Hi @bayoglu,

    It appears to be working for me.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Viewport1.Set("customProperty", new { test = "initial"});
            }
        }
    
        protected void Change(object sender, DirectEventArgs e)
        {
            this.Viewport1.Set("customProperty", new { test = "dynamic" });
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />       
            <ext:Viewport ID="Viewport1" runat="server">
                <Items>
                    <ext:Button 
                        runat="server" 
                        Text="Show customProperty" 
                        Handler="alert(Ext.encode(App.Viewport1.customProperty));" />
    
                    <ext:Button 
                        runat="server" 
                        Text="Change customProperty" 
                        OnDirectClick="Change" />
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    By the way, during initial loading it might be better to use a Viewport's CustomConfig instead of its Set method.
  3. #3
    Hello @Daniil,

    My mistake, sorry.
    Please mark as closed.

Similar Threads

  1. [CLOSED] Encode direct event config
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Oct 17, 2012, 9:29 PM
  2. [CLOSED] Add/Save Complex Objects?
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 04, 2011, 5:35 PM
  3. Replies: 3
    Last Post: Apr 20, 2010, 12:21 PM
  4. Saving grid changes with complex objects
    By fquintero in forum 1.x Help
    Replies: 3
    Last Post: Oct 13, 2009, 1:19 PM
  5. mapping more complex objects to a Store
    By principal_X in forum 1.x Help
    Replies: 2
    Last Post: Jan 26, 2009, 6:16 PM

Posting Permissions