ComboxBox in an editable Grid - javascript

I am new in ExtJS and now I am making an editable grid with a combox column. I am having a problem in displaying my chosen data from the combobox. May someone help me. Screenshot is provided below.
Link provided.. :))
My combobox code...
Data:
var farms = new Ext.data.ArrayStore({
fields: ['id', 'farms'],
data : [
['1', 'DVZ'],
['2', 'SSK'],
['3', 'LNA'],
['4', 'NSK']
]
});
Combobox..
header : 'Location',
width : 130,
fixed : true,
hideable : false,
dataIndex: 'farms',
editor : {xtype:'combo',
store: farms,
displayField:'farms',
valueField: 'id',
queryMode: 'local',
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
emptyText: 'Select location...',
autoload: true
}

it's might be that your dataindex value in grid config, not same like you value field in combobox config
for example, look at this config on "Responsible" field
columns: [
{ header: 'ID', dataIndex: 'id', width: 50, hidden: true, sortable: true },
{header: 'Responsible',
width: 175,
sortable: true,
renderer: title_respU_D1,
dataIndex: 'resp_user_name'
,editor: new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
store: app_responsibleStore,
mode: 'remote',
valueField: 'resp_user_name',
displayField: 'resp_user_name',
listClass: 'x-combo-list-small'
})
}
]

You may be missing some "config" in editor config of items in grid panel.
I hope you may missed typeAhead config.
Please refer below link of sencha example
http://docs.sencha.com/extjs/4.0.7/extjs-build/examples/grid/cell-editing.html
Thanks.

Related

combobox editor of gridcolumn issue

Whenever I choose an item from the combobox, the combobox goes up on the screen. It only disappear when I move on the second column or do anything. It is quite annoying. How do I make it fixed on the grid? Is this a bug? Here is my code:
{
header: "Description",
sortable: false,
width: 250,
renderTo: Ext.getBody(),
editor: new Ext.form.field.ComboBox( {
enableKeyEvents:true,
typeAhead: true,
typeAheadDelay: 100,
queryMode: 'local',
forceSelection: true,
selectOnTab: true,
queryDelay : 100,
store : aob_store_inventory,
valueField: 'InvDescription',
displayField: 'InvDescription',
triggerAction: 'all',
editable : true,
listeners: {
select: function(combo, record, index) {
store_aobdetails.data.items[aob_sel_rec].data.InvID = record[0].data.InvID;
store_aobdetails.commitChanges();
combo.up('grid').getView().refresh();
}
}
}),
dataIndex: 'InvDescription'
}
fixed it by removing the code:
combo.up('grid').getView().refresh();

Filtering a combox in ExtJs

I have an ExtJs combobox. Its store loaded using JSON (using my store). I want to load all the values to the store, and then filter them with the text entered in the combo's textfield.
I don't want my combo to reload its store every time I type something. How can I do that?
And other thing that then I try to select element from combobox first time it's reload data from server.
PS: listener in my store for select first element of data from server.
Thanks.
Here's my store class :
Ext.define('KP.store.account.street', {
extend: 'Ext.data.Store',
model: 'KP.model.account.combo',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: '/account/combostreetdata'
},
reader: {
type: 'json',
root: 'combolist',
successProperty: 'success',
totalProperty: 'total'
}
},
listeners: {
'load': function (street_list) {
var street_combo = Ext.getCmp('street');
street_combo.select(street_list.getAt(0));
}
}
});
My view:
{
id: 'street',
xtype: 'combobox',
width: 700,
name: 'street',
editable: true,
mode: 'local',
typeAhead: true,
emptyText: '?????',
fieldLabel: '???',
labelWidth: 120,
size: 72,
x: 20,
y: 180,
displayField: 'string_value',
valueField: 'long_key',
store: street_list
},
You have a ComboBox config error.
Not mode: 'local', but queryMode: 'local',.
I use such a fields in my combos:
queryMode: 'local',
forceSelection: true,
Typeahead works fine, no data loads during typeahead.

EXTJS comboBox multiselect

In the ExtJS 3.3.1, I tried to make comboBox to multi select , but it doesn't work.
Please help.
var mArray = new Array("ALL", "AAA", "BBB");
var mCombo = new Ext.form.ComboBox({ id: 'ID', fieldLabel: 'ID',
triggerAction: 'all',
height: 100, width: 163,
multiSelect: true,
store: mArray
});
Ext.getCmp('mCombo').setValue("ALL");
There isn't a config option like multiSelect in Ext.form.ComboBox.
To get desired functionality you either need to develop a multiselect combobox by your own or use one of existing alternatives, like Ext.ux.form.CheckboxCombo, Ext.ux.form.SuperBoxSelect and Ext.ux.form.LovCombo.
return new Ext.form.ComboBox({
fieldLabel: fieldLabel,
hiddenName: name,
store: store ,
valueField:'value',
displayField:'value',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select '+fieldLabel+' ...',
selectOnFocus:true,
allowBlank:allowBlank,
forceSelection : true,
disabled:disabled,
multiSelect:true,
width:200,
id:id,
listeners:{
change : function( frm, newValue, oldValue ) {
doRenderTL();
}
},
renderTo: Ext.get( renderTo )
});

ExtJs Combobox problem

Hi i have a formpanel with remote combobox, the store is jsonstore and is get from webservices with paging results, everything is well, but when you pick an option form the combo always pick the first one, you can pick the third but the combo choose the first option i don't know the reason for this the configuration for the combo is this:
{
xtype: 'combo',
fieldLabel: 'Sitio Interés',
anchor: '100%',
triggerAction: 'all',
store: dsPuntos,
mode: 'remote',
displayField: "Nombre",
valueField: "Id",
typeAhead: false,
width: 222,
hideLabel: true,
allowBlank: false,
id: 'cboDato',
editable: true,
pageSize: 20,
minChars: 0,
hideTrigger: true,
//enableKeyEvents: true,
emptyText: 'Escriba un sitio de interés',
tpl: '<tpl for="."><div class="x-combo-list-item">{Nombre} - {Municipio}</div></tpl>',
listeners: {
scope: this,
specialkey: function (f, e) {
if (e.getKey() == e.ENTER) {
Ext.getCmp('btnConsultar').handler.call(Ext.getCmp('btnConsultar').scope);
}
}
}
},
and the store is here:
var dsPuntos = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'Services/MapService.svc/GetSitiosInteres',
method: 'GET'
}),
root: 'd.rows',
totalProperty: 'd.total',
id: 'Id',
fields: ['Nombre', 'Municipio', 'Id']
});
Thanks
Your store config is a little off. It should be idProperty instead of id. Also check the json coming from the server. Make sure that the id are unique.

ExtJs combo forced to select the first item (with example code)

I have a combo B that gets loaded by other combo A (triggered by 'select' listener)
once B is populated, I see all items but now from drop-down in Combo B,
I'm force to select the first item with mouse
I can select other item only by typing
Please help!!!!
code for Combo A
{
xtype: 'combo',
displayField: 'value',
emptyText: 'Please select A first',
fieldLabel: 'Combo A',
id: 'comboA',
maxHeight: 240,
mode: 'local',
triggerAction: 'all',
typeAhead: true,
typeAheadDelay: 100,
valueField: 'id',
store: new Ext.data.JsonStore({
url: '/cgi-bin/server.cgi',
fields: ['id', 'name'],
baseParams: {
action: 'getAList'
},
autoLoad: true,
root: 'aList'
}),
listeners: {
'select': {
fn: function(){
var comboB = Ext.getCmp('comboB');
comboB.clearValue();
comboB.store.removeAll();
comboB.store.reload({
params: {
id: this.getValue()
}
})
}
}
}
}
Code for combo B:
{
xtype: 'combo',
displayField: 'item',
editable: true,
emptyText: 'Select a Combo A first',
fieldLabel: 'Combo B',
id: 'comboB',
lazyInit: true,
maxHeight: 240,
mode: 'local',
triggerAction: 'all',
typeAhead: true,
valueField: 'id',
width: 220,
store: new Ext.data.JsonStore({
url: '/cgi-bin/server.cgi',
root: 'bList',
autoLoad: false,
fields: ['id,', 'item'],
baseParams: {
action: 'getBList'
},
listeners: {
'beforeload': function(){
Ext.getCmp('comboB').disable();
},
'load': function(){
Ext.getCmp('comboB').enable();
}
}
})
}
Not sure what exactly is wrong here but I suspect this piece in your comboA is not getting fired as expected -
comboB.store.reload({
params: {
id: this.getValue()
}
})
So comboB is still disabled. when you click on the comboB trigger, it loads the store and the comboB's store's load listener is kicking in as expected to enable the combo.
Try putting some debug statements or stepping through the piece of code above.

Categories