PDA

View Full Version : [CLOSED] Combo box items add



speedstepmem4
Aug 18, 2014, 6:51 AM
Hi,

Items are not able to add in combo box store client side.


<ext:ComboBox ID="cboTaskType" runat="server" Width="200" Editable="false">
</ext:ComboBox>


var taskStore = Ext.getCmp('cboTaskType').getStore();
taskStore.removeAll();

taskStore.add(new Ext.data.Record({ text: "test1", value: 1 }));
taskStore.add(new Ext.data.Record({ text: "test2", value: 3 }));

Ext.getCmp('cboTaskType').setValue('1');



Above code sample works in ext 1.x version

Vladimir
Aug 18, 2014, 9:26 AM
Hi

Please see the following sample
http://examples2.ext.net/#/Form/ComboBox/Items_Actions/

speedstepmem4
Aug 20, 2014, 6:15 AM
Hi,

We were using the below mentioned code part to remove the selected item from a combobox in 1x version.



cmb_Template.store.remove(cmb_Template.store.getAt (cmb_Template.getSelectedIndex()));


The sample code is not working in ext 2x version which returns the error as getselectedIndex() is undefined!

Note: Please provide us the needed in client side.

Please guide us!!!

Daniil
Aug 20, 2014, 11:56 AM
Please use this code to get an index of selected record.

var index;

App.ComboBox1.findRecordByValue(App.ComboBox1.getV alue()),
index = App.ComboBox1.getStore().indexOf(record);

Vladimir
Aug 20, 2014, 1:35 PM
Also, deleting selected record is demonstrated in already mentioned online example (see clear trigger handler)