Aug 25, 2015, 7:46 AM
[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!
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]