Mar 11, 2009, 3:47 PM
Can't get three cascading comboboxes to work (two work fine)
I have three stores tied to three ComboBoxes that I want to populate in order (cascading) during the initial page load. However, I cannot get the third ComboBox (ID=DropDownList_Lines) to populate. The problem seems to be that the stores don't load in the correct order. Most of the time, store 3 loads before store 2 which causes the parameters passed to store 2 to be empty. Although sometimes (rarely) the stores do get called in the correct order but the parameter from the Dates ComboBox is always empty anyway.
Store1 (LocationsStore) is populated during page_load() and it triggers the cascading action.
Everything works fine if I manually select values, the problem is only on the initial load of the page.
Here are my stores:
Store1 (LocationsStore) is populated during page_load() and it triggers the cascading action.
Everything works fine if I manually select values, the problem is only on the initial load of the page.
Here are my stores:
<ext:Store ID="LocationsStore" runat="server" AutoLoad="true">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="id" />
</Fields>
</ext:ArrayReader>
</Reader>
<Listeners>
<Load Handler="#{DropDownList_Locations}.setValue(#{DropDownList_Locations}.store.getAt(0).get('id'));" />
</Listeners>
</ext:Store>
<ext:Store runat="server" ID="DatesStore">
<Proxy>
<ext:HttpProxy runat="server" Method="POST" Url="BillsWebService.asmx/GetDates" />
</Proxy>
<Reader>
<ext:XmlReader Record="ValueId">
<Fields>
<ext:RecordField Name="dId" Type="String" Mapping="Id" />
<ext:RecordField Name="dValue" Type="String" Mapping="Value" />
</Fields>
</ext:XmlReader>
</Reader>
<BaseParams>
<ext:Parameter Name="Store" Value="#{DropDownList_Locations}.getValue()" Mode="Raw" />
</BaseParams>
<Listeners>
<Load Handler="#{DropDownList_Dates}.setValue(#{DropDownList_Dates}.store.getAt(0).get('dId'));" />
</Listeners>
</ext:Store>
<ext:Store runat="server" ID="LinesStore">
<Proxy>
<ext:HttpProxy runat="server" Method="POST" Url="BillsWebService.asmx/GetLines" />
</Proxy>
<Reader>
<ext:XmlReader Record="ValueId">
<Fields>
<ext:RecordField Name="lId" Type="String" Mapping="Id" />
<ext:RecordField Name="lValue" Type="String" Mapping="Value" />
</Fields>
</ext:XmlReader>
</Reader>
<BaseParams>
<ext:Parameter Name="locName" Value="#{DropDownList_Locations}.getValue()" Mode="Raw" />
<ext:Parameter Name="billId" Value="#{DropDownList_Dates}.getValue()" Mode="Raw" />
</BaseParams>
<Listeners>
<Load Handler="#{DropDownList_Lines}.setValue(#{DropDownList_Lines}.store.getAt(0).get('lId'));" />
</Listeners>
</ext:Store>
And here are my three ComboBoxes<ext:ComboBox ID="DropDownList_Locations" runat="server" Editable="false" TypeAhead="true" DisplayField="id" ValueField="id" Mode="Local" TriggerAction="All" SelectOnFocus="true" StoreID="LocationsStore" >
<Listeners>
<Select Handler="#{DropDownList_Dates}.clearValue();#{DatesStore}.load();#{LinesStore}.removeAll();#{DropDownList_Lines}.clearValue();" />
</Listeners>
</ext:ComboBox>
<ext:ComboBox ID="DropDownList_Dates" runat="server" StoreID="DatesStore" Editable="false" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="dValue" ValueField="dId" EmptyText="Select a date" ValueNotFoundText="Value Not Found...">
<Listeners>
<Select Handler="#{DropDownList_Lines}.clearValue();#{LinesStore}.load();" />
</Listeners>
</ext:ComboBox>
<ext:ComboBox ID="DropDownList_Lines" runat="server" StoreID="LinesStore" Editable="false" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="lValue" ValueField="lId" EmptyText="Select a line" ValueNotFoundText="Value Not Found...">
</ext:ComboBox>