Sep 01, 2013, 5:20 PM
[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:
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]