[CLOSED] Dynamically add a code to get a row and use the required parameters

  1. #1

    [CLOSED] Dynamically add a code to get a row and use the required parameters

    Hi Team !!

    I have the following problem, i have implemented the exercise "Row Expander Plugin with GridPanel" but I want to dynamically add a code to get a row and use the required parameters, but I can not find the code for that.

    
    <%@ 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 <= 5; 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" }
                    }
                },
                BottomBar = 
                {
                    new PagingToolbar
                    {
                        DisplayInfo = true
                        , DisplayMsg = "{0} - {1} de {2}"
                        , EmptyMsg = "No hay registros a desplegar"
                    }
                },
                SelectionModel =
                {
                    new RowSelectionModel
                    {
                        Mode = Ext.Net.SelectionMode.Single
                        , DirectEvents =
                        {
                            Select = 
                            {
                                // ???????????????????????????
                            }
                        }
                    }
                }
            };
    
            return ComponentLoader.ToConfig(grid);
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>RowExpander with GridPanel - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <h1>Row Expander Plugin with GridPanel</h1>
            
            <p>The caching is presented, GridPanel renders once only (until view refresh)</p>
    
            <ext:GridPanel ID="GridPanel1" 
                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 ID="Model1" runat="server" IDProperty="ID">
                                <Fields>
                                    <ext:ModelField Name="ID" />
                                    <ext:ModelField Name="Name" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel1" runat="server">               
                    <Columns>       
                        <ext:Column ID="Column1" runat="server" Text="Supplier" DataIndex="Name" Flex="1" />
                    </Columns>
                </ColumnModel>            
                <Plugins>
                    <ext:RowExpander ID="RowExpander1" runat="server">
                        <Loader ID="Loader1" 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>

    Any Help is appreciated.
    Regards.
    Last edited by Daniil; Jul 01, 2014 at 2:23 PM. Reason: [CLOSED]
  2. #2
    Hi @opendat2000,

    Before we sort out the problem with retrieving the required parameters, please note that there is a limitation with inner GridPanels. As far as you can see the rows in the inner GridPanels are not selected

    Please see #3:
    https://examples2.ext.net/#/GridPane...vel_GridPanel/

    3. A parent and a nested GridPanels must not use row and checkbox selection models at the same time.
    A GridPanel has a RowSelectionModel by default. So, the parent GridPanel in your example has a RowSelectionModel.

    If you want to use a RowSelectionModel for inner GridPanels, you should set
    <SelectionModel>
        <ext:CellSelectionModel runat="server" />
    </SelectionModel>
    for the parent GridPanel. Is that applicable for you?

    Another problem that you won't be able to use DirectEvents with a dynamic control. Please use a combination of a client side listener and a DirectMethod.
  3. #3
    Daniil thank you very much for your support

    Topic closed....

    Saludos
    Mauricio.

Similar Threads

  1. Replies: 8
    Last Post: Apr 22, 2014, 7:42 PM
  2. [CLOSED] Required/Not Required Text Fields Alignment - FormPanel
    By Istofix in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Mar 04, 2014, 12:50 PM
  3. Replies: 6
    Last Post: Sep 24, 2013, 6:55 AM
  4. [CLOSED] Generate Parameters of loader dynamically
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 29, 2013, 11:59 AM
  5. Replies: 6
    Last Post: Dec 27, 2011, 8:47 AM

Posting Permissions