RowExpander Subdata Loader Problem

Page 1 of 2 12 LastLast
  1. #1

    RowExpander Subdata Loader Problem

    In the following UserControl my main data is loading but when I click an expander(the plus) the Loader mask just says loading and nothing happens beyond this point. Here is my code below that is not working. Notice it's nested in windows, modules and DesktopModuleProxies. The nesting is where I suspect the problem is.


     <%@ Control Language="C#" %>
     
    <%@ Import Namespace="System.Collections.Generic"%>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
    
       protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest)
            {
                //We do not need to DataBind on an DirectEvent
                return;
            }
            
            List<object> data = new List<object>();
            
            for (int i = 1; i <= 10; i++)
            {
                data.Add(new { ID = "S" + i, Name = "Supplier " + i});
            }
            
            this.Store1.DataSource = data;
            this.Store1.DataBind();
        }
        
        [DirectMethod]
        public static string GetGrid(Dictionary<string, string> parameters)
        {
            // string id = parameters["id"];
            
            List<object> data = new List<object>();
            
            for (int i = 1; i <= 10; i++)
            {
                data.Add(new { ID = "P" + i, Name = "Product " + i });
            }
    
            GridPanel grid = new GridPanel
            {
                Height = 200,
                EnableColumnHide = false,
                Store = 
                { 
                    new Store 
                    { 
                        Model = {
                            new Model {
                                IDProperty = "ID",
                                Fields = 
                                {
                                    new ModelField("ID"),
                                    new ModelField("Name")
                                }
                            }
                        },
                        DataSource = data
                    }
                },
                ColumnModel =
                {
                    Columns = 
                    { 
                        new Column { Text = "Products's Name", DataIndex = "Name" }
                    }
                }
            };
    
            return ComponentLoader.ToConfig(grid);
        }   
    
    
    </script>
    
    
    <ext:DesktopModuleProxy ID="DesktopModuleProxy1" runat="server">
        <Module ModuleID="Enterprise-View-win">
            <Shortcut Name="Enterprise View" IconCls="x-grid-shortcut" SortIndex="4" />
            <Launcher Text="Enterprise View" Icon="Table" />
            <Window>
                <ext:Window ID="winEnterpriseView" runat="server"
                    Icon="Table"
                    Width="740"
                    Height="480"
                    AnimCollapse="false"
                    ConstrainHeader="true"               
                    Layout="Fit"
                    Title="Enterprise View">
    
                    <Items>                   
                       
                           <ext:GridPanel 
                runat="server"             
                Title="Expander Rows with GridPanel"
                Collapsible="true"
                AnimCollapse="true" 
                Icon="Table" 
                Width="600"
                Height="450"
                DisableSelection="true">
                <Store>
                    <ext:Store ID="Store1" runat="server">
                        <Model>
                            <ext:Model runat="server" IDProperty="ID">
                                <Fields>
                                    <ext:ModelField Name="ID" />
                                    <ext:ModelField Name="Name" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">               
                    <Columns>
                        <ext:Column runat="server" Text="Supplier" DataIndex="Name" Flex="1" />
                    </Columns>
                </ColumnModel>            
                <Plugins>
                    <ext:RowExpander runat="server">
                        <Loader runat="server" DirectMethod="#{DirectMethods}.GetGrid" Mode="Component">
                            <LoadMask ShowMask="true" />
                            <Params>
                                <ext:Parameter Name="id" Value="this.record.getId()" Mode="Raw" />
                            </Params>
                        </Loader>
                    </ext:RowExpander>
                </Plugins>            
            </ext:GridPanel>
                    </Items>
                </ext:Window>
            </Window>
        </Module>
    </ext:DesktopModuleProxy>
    The script and markup above should go inside a user control and then add that control to an aspx page. The code below should be placed directly into an aspx page.

    Now when I copy the guts into a plain .aspx page it works as expected. Note that the only difference is the commented out ViewRelation stuff. Here is that code.

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic"%>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
    
       protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest)
            {
                //We do not need to DataBind on an DirectEvent
                return;
            }
            
            List<object> data = new List<object>();
            
            for (int i = 1; i <= 10; i++)
            {
                data.Add(new { ID = "S" + i, Name = "Supplier " + i});
            }
            
            this.Store1.DataSource = data;
            this.Store1.DataBind();
        }
        
        [DirectMethod]
        public static string GetGrid(Dictionary<string, string> parameters)
        {
            // string id = parameters["id"];
            
            List<object> data = new List<object>();
            
            for (int i = 1; i <= 10; i++)
            {
                data.Add(new { ID = "P" + i, Name = "Product " + i });
            }
    
            GridPanel grid = new GridPanel
            {
                Height = 200,
                EnableColumnHide = false,
                Store = 
                { 
                    new Store 
                    { 
                        Model = {
                            new Model {
                                IDProperty = "ID",
                                Fields = 
                                {
                                    new ModelField("ID"),
                                    new ModelField("Name")
                                }
                            }
                        },
                        DataSource = data
                    }
                },
                ColumnModel =
                {
                    Columns = 
                    { 
                        new Column { Text = "Products's Name", DataIndex = "Name" }
                    }
                }
            };
    
            return ComponentLoader.ToConfig(grid);
        }   
    
    
    </script>
    
    
    
    <!DOCTYPE html>
     
    <html>
    <head runat="server">
        <title>RowExpander with GridPanel - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
                <ext:GridPanel 
                runat="server"             
                Title="Expander Rows with GridPanel"
                Collapsible="true"
                AnimCollapse="true" 
                Icon="Table" 
                Width="600"
                Height="450"
                DisableSelection="true">
                <Store>
                    <ext:Store ID="Store1" runat="server">
                        <Model>
                            <ext:Model runat="server" IDProperty="ID">
                                <Fields>
                                    <ext:ModelField Name="ID" />
                                    <ext:ModelField Name="Name" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">               
                    <Columns>
                        <ext:Column runat="server" Text="Supplier" DataIndex="Name" Flex="1" />
                    </Columns>
                </ColumnModel>            
                <Plugins>
                    <ext:RowExpander runat="server">
                        <Loader runat="server" DirectMethod="#{DirectMethods}.GetGrid" Mode="Component">
                            <LoadMask ShowMask="true" />
                            <Params>
                                <ext:Parameter Name="id" Value="this.record.getId()" Mode="Raw" />
                            </Params>
                        </Loader>
                    </ext:RowExpander>
                </Plugins>            
            </ext:GridPanel>
    
    </form>
    </body>
    </html>
    Please help.
    Last edited by thewisegod; Feb 13, 2013 at 12:40 PM.
  2. #2
    Hello!

    Welcome to the forum!

    Please, wrap your code with CODE tag. Also to reproduce your problem can you provide simplified sample.

    More information you can read here:
    http://forums.ext.net/showthread.php?3440
    http://forums.ext.net/showthread.php?10205
  3. #3
    I wrapped the code and got rid of some code that wasn't needed.
  4. #4
    Quote Originally Posted by thewisegod View Post
    I wrapped the code and got rid of some code that wasn't needed.
    We should be able to run your code without any changes. But in your code you are using this
    Itel.DataLayer.Data.Repositories.Core.RepositoryHelper.GetEnterpriseViewRepository()
  5. #5
    The code has now been edited to use you demo RowExpander sample in the way that I am trying to use it. Again in the top portion of code that I want placed in a user control, the loaders for the subgrids just spin and nothing happens.
  6. #6

    Same issue

    Hello

    I am having the exact same issue (I just realized thewisegod works with me :) ). I want to have a grid with a subgrid using the rowexpanded but when you turn it into a web control and put it inside a DesktopModuleProxy you run into this same issue.


    I noticed that in your changelog you specified

    [r4286] DirectEvents for widgets inside DesktopModuleProxy is not executed (exception)

    I am not sure if it's a related issue or not

    Thanks in advance

    Below is my code sample (I used one of your examples and simply put in a web control and put a DesktopModuleProxy around it).
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Test.ascx.cs" Inherits="Itel.Enterprise.Web.Views.modules.Test" %>
    <%@ Import Namespace="Ext.Net.Utilities"%>
    <%@ Import Namespace="System.Collections.Generic"%>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest)
            {
                //We do not need to DataBind on an DirectEvent
                return;
            }
            
            //Build first level
            this.BuildLevel(null);
        }
    
        [DirectMethod]
        public string BuildLevel(Dictionary<string, string> parameters)
        {
            int level = parameters != null && parameters.ContainsKey("level") ? int.Parse(parameters["level"]) : 1;
            
            // bind store
            List<object> data = new List<object>();
    
            for (int i = 1; i <= 10; i++)
            {
                data.Add(new { ID = i, Name = "Level".ConcatWith(level, ": Row " + i) });
            }
            
            //build grid
            GridPanel grid = new GridPanel
                {
                    Height = 215,
                    HideHeaders = level != 1,
                    DisableSelection = true,
                    Store = 
                    { 
                        new Store 
                        {                        
                            Model = 
                            {
                                new Model 
                                {
                                    IDProperty = "ID",
                                    Fields =
                                    {
                                        new ModelField("ID"),
                                        new ModelField("Name"),
                                        new ModelField
                                        {
                                            Name = "Level",
                                            DefaultValue = level.ToString()
                                        }
                                    }
                                }   
                            },                        
                            DataSource = data   
                        }
                    },
                    ColumnModel =
                    {
                        Columns =
                        {
                            new Column { DataIndex = "Name", Text = "Name", Flex = 1 }
                        }
                    },
                    View =
                    {
                        new Ext.Net.GridView()
                        {
                            OverItemCls = " " //to avoid the known issue #6
                        }
                    }
                };
    
            // add expander for all levels except last (last level is 5)
            if (level < 5)
            {
                RowExpander re = new RowExpander
                {                
                    ScrollOffset = 10,
                    Loader = new ComponentLoader 
                    { 
                        Mode = LoadMode.Component,
                        DirectMethod = "#{DirectMethods}.BuildLevel",
                        LoadMask = 
                        {
                            ShowMask = true
                        },
                        Params = 
                        {
                            new Ext.Net.Parameter("level", (level + 1).ToString(), ParameterMode.Raw),
                            new Ext.Net.Parameter("id", "this.record.getId()", ParameterMode.Raw)
                        }
                    }
                };
    
                grid.Plugins.Add(re);
            }
    
            if (level == 1)
            {
                grid.Title = "MultiLevel grid";
                grid.Width = 600;
                grid.Height = 600;
                grid.ResizableConfig = new Resizer { Handles = ResizeHandle.South };
                Window10.Items.Add(grid);
                //this.Form.Controls.Add(grid);            
            }
            else
            {
                grid.EnableColumnHide = false;
                return ComponentLoader.ToConfig(grid);
            }  
            
            return null;
        }
    </script>
    
    
    <link href="/resources/css/examples.css" rel="stylesheet" />
    
    <ext:DesktopModuleProxy ID="DesktopModuleProxy1" runat="server">
        <Module ModuleID="test-win">
            <Shortcut Name="Test Window" IconCls="x-grid-shortcut" SortIndex="1" />
            <Launcher Text="Test Window" Icon="Table" />
            <Window>
                <ext:Window ID="Window10" runat="server"
                    Icon="Table" 
                    Width="740" 
                    Height="480" 
                    AnimCollapse="false"
                    ConstrainHeader="true"                
                    Layout="Fit"
                    Title="Test Window">
                    <Items>
                    </Items>
                </ext:Window>
            </Window>
        </Module>
    </ext:DesktopModuleProxy>
    Last edited by itel; Feb 13, 2013 at 6:53 PM.
  7. #7
    Your problem is that you call DirectMethod from UserControl but DirectMethod of UserControls should be called in different way. Look at this examples:

    https://examples2.ext.net/#/Events/D.../UserControls/
    https://examples2.ext.net/#/Events/D...thods/ID_Mode/
  8. #8
    Quote Originally Posted by Baidaly View Post
    Your problem is that you call DirectMethod from UserControl but DirectMethod of UserControls should be called in different way. Look at this examples:

    https://examples2.ext.net/#/Events/D.../UserControls/
    https://examples2.ext.net/#/Events/D...thods/ID_Mode/
    Hi Daulet

    I'm not sure I understand the relationship of the sample you provided with what we provided. The sample you provided is different in that the directMethod is called outside the user control. In this case the gridpanel is contained within the user control so the row expander should definition is contained within the control. Is there any way you can rework the sample we provided, it's just not clear how to solve this.


    thank you very much
  9. #9
    Try to do the following in your .ascx:

    [DirectMethod(IDMode = DirectMethodProxyIDMode.None)]
    public string BuildLevel(Dictionary<string, string> parameters)
    ...
    You can read the following thread for more information: http://forums.ext.net/showthread.php...in-usercontrol
  10. #10
    Quote Originally Posted by Baidaly View Post
    Try to do the following in your .ascx:

    [DirectMethod(IDMode = DirectMethodProxyIDMode.None)]
    public string BuildLevel(Dictionary<string, string> parameters)
    ...
    You can read the following thread for more information: http://forums.ext.net/showthread.php...in-usercontrol
    Perfect! That worked! Thank you so much
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] reference of a control loaded by component loader
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 28, 2012, 1:05 PM
  2. [CLOSED] Problem with RowExpander Level3
    By osef in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 15, 2012, 11:23 PM
  3. [CLOSED] Problem with RowExpander
    By osef in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 14, 2012, 4:46 PM
  4. Replies: 8
    Last Post: Aug 13, 2012, 11:47 PM
  5. Replies: 11
    Last Post: Jun 22, 2012, 6:10 PM

Tags for this Thread

Posting Permissions