[CLOSED] how to set Column 's id and text from dropdownlist

  1. #1

    [CLOSED] how to set Column 's id and text from dropdownlist

     <ext:Column ID="col_kjkm" runat="server" Text="会计科目" Flex="1" DataIndex="Ccode">
                                            <Editor>
                                                <ext:DropDownField runat="server">
                                                    <Component>
                                                        <ext:TreePanel runat="server" ID="tp_subject" MaxHeight="200" Shadow="false" UseArrows="true" AutoScroll="true" Animate="true" RootVisible="false">
                                                            <Store>
                                                                <ext:TreeStore runat="server">
    
                                                                    <Proxy>
                                                                        <ext:AjaxProxy Url="~/BasicInfoAshx/SubjectTree.ashx">
                                                                        </ext:AjaxProxy>
                                                                    </Proxy>
                                                                </ext:TreeStore>
                                                            </Store>
                                                            <DirectEvents>
                                                                <ItemDblClick OnEvent="NodeDbClick">
                                                                    <ExtraParams>
                                                                        <ext:Parameter runat="server" Name="id" Value="record.data.id" Mode="Raw" />
                                                                        <ext:Parameter runat="server" Name="text" Value="record.data.text" Mode="Raw" />
                                                                    </ExtraParams>
                                                                </ItemDblClick>
                                                            </DirectEvents>
                                                        </ext:TreePanel>
                                                    </Component>
                                                </ext:DropDownField>
                                            </Editor>
                                        </ext:Column>
    protected void NodeDbClick(object sender, DirectEventArgs e)
            {
                string id = e.ExtraParams["id"];
                string text = e.ExtraParams["text"];
                
            }
    i get id and text from treepanel, but how to set id and text to the column col_kjkm?
    Last edited by Daniil; May 28, 2013 at 4:13 AM. Reason: [CLOSED]
  2. #2
    Hi @hdsoso,

    If you need to use a value/text pair you should use Mode="ValueText".
    http://examples2.ext.net/#/Form/Drop...alueText_Mode/

    Also I think instead of an ItemDblClick DirectEvent, you use an ItemDblClick listener and call a DropDownField's setValue method in a similar way as it is done within the CheckChange listener of the example mentioned above.
  3. #3
    can't hold on the text value in the cell which column id is "col_kjkm" when click other cell after double click the tree item.
    plz see http://screencast.com/t/qs8GWdsUB

    my code
     <ext:GridPanel runat="server" ID="gp_pingzheng">
    
                                <Store>
                                    <ext:Store runat="server" ID="store_pz">
                                        <Model>
                                            <ext:Model ID="Model1" runat="server">
                                                <Fields>
                                                    <ext:ModelField runat="server" Name="Digest"></ext:ModelField>
                                                    <ext:ModelField runat="server" Name="Ccode"></ext:ModelField>
                                                    <ext:ModelField runat="server" Name="Jfsl"></ext:ModelField>
                                                    <ext:ModelField runat="server" Name="Dfsl"></ext:ModelField>
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel>
                                    <Columns>
                                        <ext:SummaryColumn ID="Column1" runat="server" Text="摘要" Flex="2" DataIndex="Digest">
                                            <SummaryRenderer Handler="return '合计:'"></SummaryRenderer>
                                            <Editor>
                                                <ext:TextField ID="TextField1" runat="server"></ext:TextField>
                                            </Editor>
                                        </ext:SummaryColumn>
                                        <ext:Column ID="col_kjkm" runat="server" Text="会计科目" Flex="1" DataIndex="Ccode">
                                            <Editor>
                                                <ext:DropDownField ID="ddf_kemu" runat="server" Mode="ValueText">
                                                    <Component>
                                                        <ext:TreePanel runat="server" ID="tp_subject" MaxHeight="400" Shadow="false" UseArrows="true" AutoScroll="true" Animate="true" RootVisible="false">
                                                            <View>
                                                                <ext:TreeView ID="TreeView1" runat="server" LoadMask="true" />
                                                            </View>
                                                            <Store>
                                                                <ext:TreeStore runat="server">
    
                                                                    <Proxy>
                                                                        <ext:AjaxProxy Url="~/BasicInfoAshx/SubjectTree.ashx">
                                                                        </ext:AjaxProxy>
                                                                    </Proxy>
                                                                </ext:TreeStore>
                                                            </Store>
                                                            <DirectEvents>
                                                                <ItemDblClick OnEvent="NodeDbClick">
                                                                    <ExtraParams>
                                                                        <ext:Parameter runat="server" Name="id" Value="record.data.id" Mode="Raw" />
                                                                        <ext:Parameter runat="server" Name="text" Value="record.data.text" Mode="Raw" />
                                                                        <ext:Parameter runat="server" Name="leaf" Value="record.data.leaf" Mode="Raw" />
                                                                    </ExtraParams>
                                                                </ItemDblClick>
                                                            </DirectEvents>
                                                        </ext:TreePanel>
                                                    </Component>
                                                </ext:DropDownField>
                                            </Editor>
                                        </ext:Column>
                                        <ext:SummaryColumn SummaryType="Sum" ID="NumberColumn1" runat="server" Flex="1" Text="借方金额" DataIndex="Jfsl">
                                            <Renderer Handler="if(value!=null)return value +'元';" />
                                            <SummaryRenderer Handler="if(value!=0)return value +'元';" />
                                            <Editor>
                                                <ext:NumberField ID="NumberField3" runat="server"></ext:NumberField>
                                            </Editor>
                                        </ext:SummaryColumn>
                                        <ext:SummaryColumn SummaryType="Sum" ID="NumberColumn2" runat="server" Flex="1" Text="贷方金额" DataIndex="Dfsl">
                                            <Renderer Handler="if(value!=null)return value +'元';" />
                                            <SummaryRenderer Handler="if(value!=0)return value +'元';" />
                                            <Editor>
                                                <ext:NumberField ID="NumberField4" runat="server"></ext:NumberField>
                                            </Editor>
                                        </ext:SummaryColumn>
                                    </Columns>
                                </ColumnModel>
                                <Features>
                                    <ext:Summary ID="Summary1" runat="server" />
                                </Features>
                                <Plugins>
                                    <ext:CellEditing ID="CellEditing1" runat="server">
                                        <Listeners>
                                            <Edit Fn="edit" />
                                        </Listeners>
                                    </ext:CellEditing>
                                </Plugins>
    
     </ext:GridPanel>
  4. #4
    You should defined a Renderer for the Column.

    Please see the Department column here.
    http://examples2.ext.net/#/GridPanel...Field_Mapping/

    There is a ComboBox as an Editor, but it is exactly your scenario.

Similar Threads

  1. Replies: 0
    Last Post: Oct 05, 2012, 2:53 PM
  2. SelectIndex on DropDownList [1.3v]
    By John_Writers in forum 1.x Help
    Replies: 0
    Last Post: Aug 21, 2012, 1:31 PM
  3. Problem about combobox on DropDownList
    By zhangsir199 in forum 1.x Help
    Replies: 0
    Last Post: Mar 11, 2011, 12:39 AM
  4. Replies: 2
    Last Post: Mar 04, 2010, 7:12 PM
  5. [CLOSED] Dropdownlist in Gridpanel
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 08, 2009, 2:10 PM

Posting Permissions