[CLOSED] how to hand over child window's data to the parents sheet's field

  1. #1

    [CLOSED] how to hand over child window's data to the parents sheet's field

    Dear all,
    I can't solve the problem how to hand over child window's row data to the parents sheet's field.
    Below, there are two sample source.
    One is parents sheet, and another is child modal window made by GridPanel.
    In the example, child window's row-selected data(deptcd) gridpanel hand over when that row data is double-clicked or row-command icon clicked.
    So, I need two solution :
    1. how to hand over when child selected-row is double-clicked.
    2. how to hand over when child row-command icon is clicked.

    [Parents Page Code]
    <script runat="server">
        protected void DeptCodeHelper(object sender, DirectEventArgs e)
        {
            UserControlRendererConfig config = new UserControlRendererConfig
            {
                UserControlPath = "DeptCodeHelper.ascx",
                SingleControl = true,
                Mode = RenderMode.RenderTo,
                Element = this.Form.ClientID
            };
    
            config.BeforeRender += delegate(ComponentAddedEventArgs ce)
            {
                ce.Control.ID = BaseControl.GenerateID();
                e.ExtraParamsResponse.Add(new Ext.Net.Parameter("windowId", ce.Control.ConfigID));            
            };
            
            UserControlRenderer.Render(config);
        }
    </script>
    
    <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="CompanyX"/>
    
       <ext:FormPanel ID="FormPanel1" runat="server" title="Department" Frame="true" Width="400"  ButtonAlign="left"  >
         <FieldDefaults LabelAlign="Left" LabelWidth="100" />
            <Items>
                <ext:FieldContainer ID="FieldContainer1" runat="server" Layout="HBoxLayout">
                    <Items>
                        <ext:TextField ID="ctlDeptNm" runat="server" FieldLabel="DeptCode"  AllowBlank="True"/>
                        <ext:Button ID="Button2" runat="server" Icon="Magnifier">
                            <DirectEvents>
                                <Click OnEvent="DeptCodeHelper" Single="true"  />
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:FieldContainer>
                <ext:Container ID="Container1" runat="server">  
                    <Items>
                        <ext:TextField ID="ctlDeptCd" runat="server" FieldLabel="DeptCode" AllowBlank="false" />
                    </Items>
                 </ext:Container>
            </Items>
        </ext:FormPanel>
    [Child Window Code]
    <ext:Window ID="Window1" runat="server" Title="CodeHelper" Width="400" Height="400" 
        MinWidth="300" MinHeight="300"  Layout="FitLayout" Resizable="true" Modal="true">
        <Items>
            <ext:FormPanel ID="FormPanel2" runat="server" Border="false" AutoDoLayout="true" BodyPadding="10">
            <Content>
                <ext:GridPanel ID="GridPanel2" runat="server"  Width="370" Height="310">
                    <Store>
                        <ext:Store ID="Store2" runat="server">
                            <Model>
                                <ext:Model ID="Model2" runat="server">
                                    <Fields>
                                        <ext:ModelField Name="DeptCd" Type="String"/>
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel>
                        <Columns>
    
                            <ext:Column ID="Column1" runat="server" Text="DeptCode" DataIndex="DeptCd" Width="60" />
                            <ext:CommandColumn ID="CommandColumn2" runat="server" Width="20">
                                <Commands>
                                    <ext:GridCommand Icon="Add" CommandName="Detail" />
                                </Commands>
                                <DirectEvents>
                                    <Command OnEvent="btnSelect">
                                        <ExtraParams>
                                            <ext:Parameter Name="cmd" Value="command" Mode="Raw" />
                                            <ext:Parameter Name="data" Value="record.data.DeptCd" Mode="Raw" />
                                        </ExtraParams>
                                    </Command>
                                </DirectEvents>
                            </ext:CommandColumn>
    
                        </Columns>            
                    </ColumnModel>  
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" >
                            <Listeners></Listeners>
                        </ext:RowSelectionModel>
                    </SelectionModel> 
                </ext:GridPanel>
            </Content>
            </ext:FormPanel>
        </Items>
    </ext:Window>
    Last edited by Daniil; Jan 21, 2015 at 12:57 PM. Reason: [CLOSED]
  2. #2
    Hi @rockhome,

    1. how to hand over when child selected-row is double-clicked.
    There is a ItemDblClick even on a GridPanel. Probably, you could try to use it.

    2. how to hand over when child row-command icon is clicked.
    You already set up a Command DirectEvent on the CommandColumn. Does it not work as you need? I guess it doesn't, because a DirectEvent should not be working in such a scenario. You render the User Control control dynamically. If you don't recreate that User control on each request, then DirectEvents cannot work. Any DirectEvent requires a control instance on server.

    I think you could use a client side Listener and do everything in JavaScript.
    Last edited by Daniil; Jan 16, 2015 at 6:45 AM.

Similar Threads

  1. Replies: 5
    Last Post: Feb 10, 2014, 3:16 AM
  2. Replies: 0
    Last Post: Mar 26, 2013, 5:54 PM
  3. Replies: 0
    Last Post: Jul 09, 2012, 11:24 AM
  4. Replies: 1
    Last Post: Feb 03, 2012, 2:36 PM
  5. Insert data from a child window
    By andrefreitasjr in forum 1.x Help
    Replies: 1
    Last Post: May 20, 2011, 12:04 PM

Tags for this Thread

Posting Permissions