[CLOSED] Add record into store of combo box doesnt work first time

  1. #1

    [CLOSED] Add record into store of combo box doesnt work first time

    Hi

    I have a situation where I want to add a record into a store of a combo box. However, this never works the first time i.e. If I click the add button once it doesnt get added into the store but if I hit the add button a second time - it is then added.

    Alternatively, if I open the dropdown (by clicking the drop down arrow) and then hit the add button for the first time it works.

    After some advice here, thanks!

               <ext:ResourceManager runat="server" ></ext:ResourceManager>
        <ext:Button Text="Holder" runat="server">
            <Menu>
                <ext:Menu runat="server">
                    <Items>
                            <ext:ComboBox runat="server" ID="dd" DisplayField="WishlistName" ValueField="WishlistName">
                            <Store>
                                <ext:Store runat="server" ID="storeWishlists">
                                    <Model>
                                        <ext:Model runat="server" Name="Wishlist" IDProperty="WishlistName">
                                            <Fields>
                                                <ext:ModelField Name="WishlistName" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>   
                                </ext:Store>
                            </Store>
                        </ext:ComboBox>
                        <ext:Button ID="Button1" Text="Add" runat="server">
                            <Listeners>
                                <Click Fn="Wishlist1.addRecord" Scope="Wishlist1"></Click>
                            </Listeners>
                        </ext:Button>
                    </Items>
                </ext:Menu>
            </Menu>
        </ext:Button>
        
        <script type="text/javascript">
            var Wishlist1 = {
                addRecord: function() {
                    this.store.add({ WishlistName: 'Another' });
                }
            };
            Ext.onReady(function() {
                Wishlist1.store = <%= storeWishlists.ClientID %>;
            });
        </script>
    Last edited by Daniil; Aug 26, 2015 at 6:12 AM. Reason: [CLOSED]
  2. #2
    Hi @glenh,

    Please try to set QueryMode="Local" for ComboBox.
  3. #3
    Thanks Daniil

    I knew I could count on you!
  4. #4
    Thank you for that!:) And you are always welcome on the forums!

Similar Threads

  1. grid.store.add() doesnt render Command Column
    By rafaelarosario in forum 2.x Help
    Replies: 1
    Last Post: Aug 07, 2014, 7:23 PM
  2. Replies: 2
    Last Post: Mar 20, 2013, 2:19 PM
  3. Replies: 9
    Last Post: Feb 14, 2013, 2:55 PM
  4. [CLOSED] Adding New Record at run time
    By jesperhp in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 27, 2012, 12:17 PM
  5. AJAX Method doesnt work
    By hbaraza in forum 1.x Help
    Replies: 1
    Last Post: Jan 15, 2009, 11:20 AM

Posting Permissions