[CLOSED] ComboBox Not Populating on First Store Reload

  1. #1

    [CLOSED] ComboBox Not Populating on First Store Reload

    I have a form that should work as follows: depending on which Radio is selected from a RadioGroup, the store of a ComboBox gets reloaded given a parameter and the ComboBox refreshes with the new data. This works fine except for the first time a Radio is selected, where it loads only the first record into the ComboBox. I can see with Fiddler that the full JSON data is being returned but for some reason it's not loading the ComboBox...

    RadioGroup:
    <ext:RadioGroup ID="SoftwareType" runat="server" FieldLabel="Software Type" LabelCls="label-cls">
        <Items>
            <ext:Radio ID="DBI_RB" runat="server" BoxLabel="DBI" Checked="false" BoxLabelCls="boxcls" />
            <ext:Radio ID="WEB_RB" runat="server" BoxLabel="WEB" Checked="false" BoxLabelCls="boxcls" />
            <ext:Radio ID="SERVER_RB" runat="server" BoxLabel="SERVER SOFTWARE" BoxLabelCls="boxcls" />
        </Items>
        <Listeners>
            <Change Handler="App.direct.enableCategories();" />
        </Listeners>
    </ext:RadioGroup>
    ComboBox:
    <ext:ComboBox ID="SoftwareCombo" runat="server" Width="425" Editable="false" FieldLabel="Software"
        FieldCls="my-field" LabelCls="label-cls" Margins="0 0 10 0" Disabled="true" StoreID="SoftwareProductsStore"
        ValueField="SOFTWARE_ID" DisplayField="SOFTWARE_NAME">
        <DirectEvents>
            <Select OnEvent="SoftwareCombo_OnSelect">
                <ExtraParams>
                    <ext:Parameter Name="record" Value="records[0].data" Mode="Raw" Encode="true" />
                </ExtraParams>
            </Select>
        </DirectEvents>
    </ext:ComboBox>
    Store for ComboBox:
    <ext:Store ID="SoftwareProductsStore" runat="server" AutoLoad="true">
        <Proxy>
            <ext:AjaxProxy Json="true" Url='<%#baseUrl%>' AutoDataBind="true">
                <ActionMethods Read="POST" Create="POST" />
                <Headers>
                    <ext:Parameter Name="Accept" Value="application/json" />
                    <ext:Parameter Name="Content-Type" Value="application/json" />
                </Headers>
                <Reader>
                    <ext:JsonReader Root="" />
                </Reader>
                <Writer>
                    <ext:JsonWriter Root="" Encode="true" />
                </Writer>
                <ExtraParams>
                    <ext:StoreParameter Name="typeFilter" Value="-1" />
                </ExtraParams>
            </ext:AjaxProxy>
        </Proxy>
        <Model>
            <ext:Model ID="SoftwareProductsModel" runat="server">
                <Fields>
                    <ext:ModelField Name="SOFTWARE_ID" Type="String" />
                    <ext:ModelField Name="SOFTWARE_NAME" Type="String" />
                    <ext:ModelField Name="SEAL_ID" Type="String" />
                    <ext:ModelField Name="SCOPE" Type="String" />
                </Fields>
            </ext:Model>
        </Model>
    </ext:Store>
    Functions that get called when a RadioGroup selection is made:
    [DirectMethod]
    public void enableCategories()
    {
        if (this.SoftwareType.CheckedItems.Count > 0)
        {
            resetform();
    
            string checkedBoxLabel = this.SoftwareType.CheckedItems[0].BoxLabel;
            if (checkedBoxLabel == "SERVER SOFTWARE")
            {
                this.Categories.Enable();
                disableForm();
            }
            else
            {
                this.Categories.Select(null);
                this.Categories.Disable();
                enableForm();
            }
        }
    }
    
    [DirectMethod]
    public void enableForm()
    {
        resetform();
        
        string softwareType = this.SoftwareType.CheckedItems[0].BoxLabel;
        if (softwareType == "SERVER SOFTWARE")
        {
            string categoryID = this.Categories.SelectedItem.Value;
            this.SoftwareProductsStore.Reload(new Ext.Net.ParameterCollection()
            {
                new Ext.Net.Parameter("typeFilter", categoryID)
            });
            this.ScopeCheckboxes.Enable();
        }
        else
        {
            this.SoftwareProductsStore.Reload(new Ext.Net.ParameterCollection()
            {
                new Ext.Net.Parameter("typeFilter", softwareType)
            });
            this.ScopeCheckboxes.Disable();
        }
    
        this.SoftwareCombo.Enable();
        this.SoftwareCombo.Select(0);
        this.txtSoftwareName.Enable();
        this.txtSEALID.Enable();
        this.btnSEALID.Enable();
        this.txtSearchsoftware.Enable();
        this.btnSearchSoftware.Enable();
        this.btnUpdate.Enable();
        this.btnRemove.Enable();
    }
    Am I missing something??
    Last edited by Daniil; Sep 03, 2013 at 3:45 AM. Reason: [CLOSED]
  2. #2
    Hi @elisa,

    When a Radio gets checked, was the ComboBox already expanded or not before?

    If not, then it re-requests data on first expand.

    Please try to set up
    QueryMode="Local"
    for the ComboBox.
  3. #3
    The ComboBox was not already expanded. I added
    QueryMode="Local"
    like you suggested and it loads normally now. Thanks!

Similar Threads

  1. Replies: 2
    Last Post: May 24, 2013, 1:54 AM
  2. [CLOSED] populating a combobox from the database
    By otouri in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 26, 2012, 5:45 PM
  3. Populating ComboBox from Store on page load
    By ikhwanhayat in forum 1.x Help
    Replies: 7
    Last Post: Feb 06, 2012, 3:56 PM
  4. [CLOSED] Combobox expands after the store reload
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 24, 2012, 7:26 AM
  5. Replies: 5
    Last Post: Jan 04, 2011, 8:09 PM

Tags for this Thread

Posting Permissions