combo bindstore not working?

  1. #1

    combo bindstore not working?

    Hi

    I want to be able to dynamically bind a combo box to an existing store. However, the items never appear in the combo box.
    It looks like the store has been bound but whenever you open the combo the items dont appear.

    NOTE: If I take out the javascript on the Ext.onReady and just assign the StoreId to the combo box everything works fine.

    Markup
    <form id="form1" runat="server">
    
            <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Gray" ScriptMode="Debug"></ext:ResourceManager>    
            <ext:Viewport 
                ID="viewPort1"
                runat="server"
                Layout="FitLayout">
                <Bin>
                    <ext:Store ID="storeRegions" runat="server">
                        <Model>
                            <ext:Model runat="server" IDProperty="RegionId">
                                <Fields>
                                    <ext:ModelField Name="RegionId" Mapping="RegionId" Type="Int"/>
                                    <ext:ModelField Name="RegionName" Mapping="RegionName" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Bin>
                <Items>
                    <ext:Panel runat="server" ID="panel1">
                        <Items>
                            <ext:ComboBox runat="server" ID="ddRegion" ValueField="RegionId" DisplayField="RegionName" Width="300">
                                    
                            </ext:ComboBox>    
                            
                        </Items>
                    </ext:Panel>
                </Items>    
            </ext:Viewport>
            <script type="text/javascript">
                Ext.onReady(function () {
    
                    var combo = Ext.getCmp('ddRegion');
                    
                    combo.bindStore('storeRegions');
    
                });
             
            </script>
        </form>
    CodeBehind
         protected void Page_Load(object sender, EventArgs e)
            {
                SkillController controller = new SkillController();
                storeRegions.Data = controller.GetRegions();
            }
    Thanks for any help
  2. #2

    Answer

    Just in case someone else is interested....

    After setting combo.bindStore(store) you must re-apply the displayfield and valuefield for some strange reason??

    
    combo.bindStore(store);
    combo.displayField = 'RegionName'
    combo.valueField = 'RegionId'

Similar Threads

  1. Replies: 2
    Last Post: Apr 10, 2015, 1:59 PM
  2. [CLOSED] Working with combo boxes
    By registrator in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Mar 23, 2015, 9:27 PM
  3. Replies: 6
    Last Post: Mar 11, 2014, 12:19 PM
  4. bindStore() causes strange behavior in Firefox
    By thedarklord in forum 1.x Help
    Replies: 4
    Last Post: Nov 02, 2011, 8:39 AM
  5. ForceSelection on Combo not working
    By jeybonnet in forum Bugs
    Replies: 2
    Last Post: Feb 01, 2009, 12:24 PM

Posting Permissions