TabPanel and ComboBox

  1. #1

    TabPanel and ComboBox

    Hello,

    The following example demonstrates that the SetValue of the ComboBox does not appear to be working:

    Example.aspx:
    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        ComboBox1.SetValue(1);
    
        TabPanel1.SetActiveTab(Tab2);
    }
    
    protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
    {
        Store1.DataSource = new object[] {
            new object[] { 1, "Timothy" },
            new object[] { 2, "Geoffrey" }    
        };
        Store1.DataBind();
    }
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager runat="server" EnablePartialRendering="True" />
            <ext:ScriptManager runat="server" AjaxViewStateMode="Include" EnableViewState="true" Theme="Gray" />
            <ext:TabPanel ID="TabPanel1" runat="server" Border="false">
                <Tabs>
                    <ext:Tab ID="Tab1" runat="server" AutoHeight="true" Title="Tab 1">
                        <Body>
                            <ext:Button ID="Button1" runat="server" AutoPostBack="true" &#111;nclick="Button1_Click" Text="Load ..." />
                        </Body>
                    </ext:Tab>
                    <ext:Tab ID="Tab2" runat="server" AutoHeight="true" Title="Tab 2">
                        <Body>
                            <ext:Store ID="Store1"
                                runat="server"
                                AutoLoad="true"
                                IgnoreExtraFields="true"
                                OnRefreshData="Store1_RefreshData">
                                <Proxy>
                                    <ext:DataSourceProxy />
                                </Proxy>
                                <Reader>
                                    <ext:ArrayReader ReaderID="Id">
                                        <Fields>
                                            <ext:RecordField Name="Id" Type="Auto" />
                                            <ext:RecordField Name="DisplayName" />
                                        </Fields>
                                    </ext:ArrayReader>
                                </Reader>
                            </ext:Store>
                            <ext:ComboBox ID="ComboBox1"
                                runat="server"
                                StoreID="Store1"
                                DisplayField="DisplayName"
                                Editable="true"
                                EmptyText="----"
                                FireSelect&#111;nload="true"
                                ForceSelection="true"
                                Mode="Local"
                                Select&#111;nfocus="true"
                                TriggerAction="All"
                                TypeAhead="true"
                                ValueField="Id"
                                Width="255" />
                        </Body>
                    </ext:Tab>
                </Tabs>
            </ext:TabPanel>
        </form>
    </body>
    </html>
    Replication steps:

    1. Load page
    2. Switch to 2nd tab, notice --- and the items available
    3. Switch back to 1st tab
    4. Click Load ...
    5. Notice it doesn't select Timothy

    Side note, I also used SetValueAndFireSelect() which also didn't work.

    Cheers,
    Timothy
  2. #2

    RE: TabPanel and ComboBox

    Hi Timothy,

    SetValue method must be used during AjaxEvent only (because it must be called after Store data is loaded)
    During postback you need use


    ComboBox1.SelectedItem.Value = "1";



    I understnad that it can confuse to use several function to set value. We will unify it soon


  3. #3

    RE: TabPanel and ComboBox

    Ooops, and here I was thinking I was doing it proper with the Set function ;)

    Thanks for clearing that up vladimir.

    Cheers,
    Timothy

Similar Threads

  1. Refresh combobox in iFrame from TabPanel
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Nov 15, 2009, 3:26 PM
  2. Combobox with tabpanel
    By Koro in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 14, 2009, 11:42 AM
  3. [CLOSED] Combobox + TabPanel
    By Koro in forum 1.x Legacy Premium Help
    Replies: 0
    Last Post: Jan 09, 2009, 8:12 PM
  4. Replies: 4
    Last Post: Sep 06, 2008, 4:02 PM
  5. TabPanel and ComboBox (Layout issue)
    By Timothy in forum Bugs
    Replies: 1
    Last Post: Sep 06, 2008, 3:04 PM

Posting Permissions