[CLOSED] ComboBox didn't sync store's change

  1. #1

    [CLOSED] ComboBox didn't sync store's change

    Hi:

    I have two ComboBoxs which name "parent" and "child".
    the parent ComboBox is:
    <ext:ComboBox ID="parent" runat="server" SelectedIndex="0" Editable="false" TabIndex="1"  AutoFocusDelay="50" AutoFocus="True">
    <Items>
    <ext:ListItem Text="<%$Resources: Strings, CoreTaskWorkIn%>" Value="ct" />
    <ext:ListItem Text="<%$Resources: Strings, DivertedTasks%>" Value="dt" />
    <ext:ListItem Text="<%$Resources: Strings, Downtimes%>" Value="dn" />
    <ext:ListItem Text="<%$Resources: Strings, Resources%>" Value="rs" />
    <ext:ListItem Text="<%$Resources: Strings, Productivity%>" Value="pr" />
    </Items>
    <Listeners>
    <Select Fn="taskTypeItemChange" Delay="1"></Select>
     </Listeners>
    </ext:ComboBox>
    the child ComboBox is:
    <ext:ComboBox ID="child" runat="server" SelectedIndex="0" Editable="false"
     StoreID="StoreTaskItemList" DisplayField="Name" ValueField="Id" TabIndex="2" TypeAhead="True"
      TriggerAction="All">
    <Listeners>
     <Select Fn="forecast.taskItemChange" Delay="1"></Select>
     </Listeners>
     </ext:ComboBox>
    the taskTypeItemChange is:
    taskTypeItemChange: function (item, leaveForecsting) {
             StoreTaskItemList.filter({ property: 'TaskType', value: item.getValue() });
                    child.setValue(StoreTaskItemList.getAt(0).get('Id'));
                    child.selectedIndex = 0;
    }
    When the page load everything is fine. I can see the child ComboBox bind the correct item.
    When I select the second item in parent ComboBox, the child ComboBox change the text in text field but when I drill down the drop box, the item is still the old items. I checked the store. The store is filter correctly, I can see the items in store changed.

    if I select the second item in parent ComboBox again, the child ComboBox's drop down item then updated correctly.

    I am really don't understand what's going on now. Could you help me out?

    Thank you
    Last edited by Daniil; Mar 12, 2012 at 11:58 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please try to add the following ComboBox AfterRender listener:
    <AfterRender Handler="this.doQuery('', true);" />
    Does it help?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Please try to add the following ComboBox AfterRender listener:
    <AfterRender Handler="this.doQuery('', true);" />
    Does it help?
    Yes, it's worked but the drop list will never change if I change the other item in parent ComboBox.
  4. #4
    I was unable to reproduce the problem.

    Here is my test case and the steps:

    1. Click Filter by "1".
    2. ComboBox shows the "item1".
    3. Click Filter by "2".
    4. ComboBox shows the "item2".

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "1", "item1" },
                    new object[] { "2", "item2" },
                    new object[] { "3", "item3" }
                };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox ID="ComboBox1" runat="server">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:ArrayReader>
                                <Fields>
                                    <ext:RecordField Name="value" />
                                    <ext:RecordField Name="text" />
                                </Fields>
                            </ext:ArrayReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <Listeners>
                    <AfterRender Handler="this.doQuery('', true);" />
                </Listeners>
            </ext:ComboBox>
            <ext:Button runat="server" Text="Filter by '1'">
                <Listeners>
                    <Click Handler="ComboBox1.getStore().filter('value', '1');" />
                </Listeners>
            </ext:Button>
            <ext:Button runat="server" Text="Filter by '2'">
                <Listeners>
                    <Click Handler="ComboBox1.getStore().filter('value', '2');" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Please provide your test case and steps.
  5. #5
    Quote Originally Posted by Daniil View Post
    I was unable to reproduce the problem.

    Here is my test case and the steps:

    1. Click Filter by "1".
    2. ComboBox shows the "item1".
    3. Click Filter by "2".
    4. ComboBox shows the "item2".

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "1", "item1" },
                    new object[] { "2", "item2" },
                    new object[] { "3", "item3" }
                };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox ID="ComboBox1" runat="server">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:ArrayReader>
                                <Fields>
                                    <ext:RecordField Name="value" />
                                    <ext:RecordField Name="text" />
                                </Fields>
                            </ext:ArrayReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <Listeners>
                    <AfterRender Handler="this.doQuery('', true);" />
                </Listeners>
            </ext:ComboBox>
            <ext:Button runat="server" Text="Filter by '1'">
                <Listeners>
                    <Click Handler="ComboBox1.getStore().filter('value', '1');" />
                </Listeners>
            </ext:Button>
            <ext:Button runat="server" Text="Filter by '2'">
                <Listeners>
                    <Click Handler="ComboBox1.getStore().filter('value', '2');" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Please provide your test case and steps.
    Hi Daniil, It's working now after I clean all the browser caches. Thanks

Similar Threads

  1. [CLOSED] ComboBox didn't show all the text
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 18, 2012, 11:38 AM
  2. Replies: 2
    Last Post: Jun 07, 2012, 8:28 AM
  3. [CLOSED] change combobox store dynasmically
    By sisa in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 22, 2011, 1:17 PM
  4. Combobox didn't render correctly
    By flaviodamaia in forum 1.x Help
    Replies: 0
    Last Post: Aug 31, 2009, 11:14 AM
  5. [CLOSED] How to sync ComboBox size after it is shown
    By einavc in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 23, 2009, 7:38 AM

Posting Permissions