[CLOSED] Combobox not loading data

  1. #1

    [CLOSED] Combobox not loading data

    Hi,

    I create a combo box and load data into its store manually, but the combo box list is empty unless before loading it was expanded at least once. I have the following code:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!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 id="Head1" runat="server">
    <script type="text/javascript">
        function onClick()
        {
            var data = [];
            data.push({ Name: 'test1', Value: 1 });
            data.push({ Name: 'test2', Value: 2 });
            data.push({ Name: 'test3', Value: 3 });
            store.loadData(data);
            combo.setValue(1);
            dialog.show();
        }
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ScriptManager ID="ScriptManager1" runat="server" />
        <ext:Store ID="store" runat="server" AutoLoad="true">
            <Reader>
                <ext:ArrayReader>
                    <Fields>
                        <ext:RecordField Name="Name" Mapping="Name" />
                        <ext:RecordField Name="Value" Mapping="Value" Type="Int" />
                        <ext:RecordField Name="Order" Mapping="Order" Type="Int" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        <ext:Button runat="server" Text="Test">
            <Listeners>
                <Click Handler="onClick()" />
            </Listeners>
        </ext:Button>
        <ext:Window ID="dialog" runat="server" Title="" Width="350" AutoHeight="true" Center&#111;nload="true" Show&#111;nload="false" Modal="true" BodyStyle="padding:10px">
            <Body>
                <ext:FormLayout runat="server">
                    <ext:Anchor Horizontal="95%">
                        <ext:ComboBox ID="combo" runat="server" StoreID="store" Editable="false" DisplayField="Name" ValueField="Value" FieldLabel="Select" ForceSelection="true" TypeAhead="false" LazyInit="false">
                        </ext:ComboBox>
                    </ext:Anchor>
                </ext:FormLayout>
            </Body>
            <Buttons>
                <ext:Button runat="server" Text="Close">
                    <Listeners>
                        <Click Handler="#{dialog}.hide()" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
        </form>
    </body>
    </html>
    The following steps can replicate that:

    1. Click the 'Test' button
    2. The combo input box has the correct value selected, but when expanded the drop down list is empty.
    3. Close the dialog and click the 'Test' button again.
    4. Expand the drop down list again - it is now populated.

    If the drop down was not expanded in step 2., it would be still empty in step 4.

    How to make the combo list load the values correctly for the first time?

    Regards,
    Tadeusz
  2. #2

    RE: [CLOSED] Combobox not loading data

    Hi,

    Set Mode="Local" for combo
  3. #3

    RE: [CLOSED] Combobox not loading data

    Awesome, thanks!
  4. #4

    RE: [CLOSED] Combobox not loading data

    The following blog post may be helpful, see http://www.jfarrell.net/2009/09/unde...obox-mode.html

    Geoffrey McGill
    Founder
  5. #5

    RE: [CLOSED] Combobox not loading data

    Thanks for this usefull information.

Similar Threads

  1. [CLOSED] Delay loading of data
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Aug 08, 2012, 4:20 PM
  2. [CLOSED] Trigger the loading of TreePanel´s data
    By RCN in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: May 18, 2012, 5:00 PM
  3. [CLOSED] Json Problems when loading lot of data
    By FpNetWorth in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Mar 22, 2011, 5:05 PM
  4. [CLOSED] Error loading Gridpanel Data
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 17, 2010, 12:40 AM
  5. [CLOSED] GridPanel Loading with Large Data Set
    By bethc in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 28, 2009, 2:20 PM

Posting Permissions