PDA

View Full Version : ComboBox in Grid



AravindThota
11 Jun 2009, 4:43 AM
I need ComboxBox for only some selected rows only. Please help me

Animal
11 Jun 2009, 4:46 AM
You are using an EditorGridPanel and one of the Columns is using a CmoboBox as an editor?

Is that the case?

AravindThota
28 Jun 2009, 11:16 PM
Thank you for your response.
Yes, that is the Case I'm are looking forward for.

suntsu
1 Jul 2009, 12:22 AM
I'm trying to create an editable grid... So far for what concern the grid no problem but when I add the combobox as the editor of one of the field I get an error telling me that object 's' doesn't exist... I found a similar case in the archives but in my case this does'nt help...

First my code :

SME_Object.Products = new Ext.extend(Ext.grid.EditorGridPanel, {
title:'Product List',
initComponent:function() {
var config = {
store: new Ext.data.JsonStore({
url: 'productList.php',
root: 'rows',
totalProperty:'totalCount',
baseParams:{cli:this.clientCode},
fields: [{name: 'id'},
{name: 'description'},
{name: 'unit'},
{name: 'unitPrice', type: 'float'},
{name: 'taxRate', type: 'float'}]
}),
columns: [{
header: 'Id',
tooltip: 'Product Code',
width: 50,
sortable: true,
dataIndex: 'id'
},{
header: 'Description',
tooltip: 'Product Description',
width: 250,
sortable: true,
dataIndex: 'description',
editor: new Ext.form.ComboBox({
name: 'description',
minChars:2,
typeAhead: true,
triggerAction: 'all',
transform:'light',
lazyRender:true,
store: this.store
})
},{
header: 'Unit',
tooltip: 'Product amount unit',
width: 30,
sortable: true,
dataIndex: 'unit'
},{
header: 'UnitPrice',
tooltip: 'Product price per amount unit',
width: 50,
sortable: true,
dataIndex: 'unitPrice'
},{
header: 'Tax rate',
tooltip: 'Product tax rate',
width: 50,
sortable: true,
dataIndex: 'taxRate'
}],
stripeRows: true,
autoHeight:true,
viewConfig:{forceFit:true,enableRowBody:true},
iconCls:'icon-product-list',
closable:true
};

Ext.apply(this, Ext.apply(this.initialConfig, config));

this.bbar = new Ext.PagingToolbar({
store:this.store,
displayInfo:true,
pageSize:15
});

SME_Object.Products.superclass.initComponent.apply(this, arguments);
},
onRender:function() {
SME_Object.Products.superclass.onRender.apply(this, arguments);
this.store.load({params:{start:0, limit:15}});
}
});I thing that the problem is the store but I can't determine with precision what's wrong with the store... scope ?, loading store after combo render itself ? Please If someone could give me a hint... This would be nice ;-)

Condor
1 Jul 2009, 12:34 AM
Write an isCellEditable method for the ColumnModel.

suntsu
1 Jul 2009, 5:27 AM
Such as this function ?

<GridPanel>.getColumnModel().isCellEditable = function(colIndex, rowIndex)
{
<if Condition then return true or false>
}

I do not really understand why I should detect myself if a cell is editable or not... This should be automatic while detecting the "editor" attribute and his attached method ? In all examples I've seen, the combo in grid works without any custom <isCellEditable> method... So I thing there is another thing that cause this problem to happen.

Ext-All-debug is always telling me : var s = Ext.getDom(this.transform); "s is null".
This line is located within the Ext.Form.comboBox class definition in Ext-all-debug.js

So, for me, the problem is located in my comboBox definition... In addition there is no problem with Ext.form.TextField

Maybe this will help ;-)

Thanks

Condor
1 Jul 2009, 6:27 AM
I thought you wanted some rows editable and some not.

ps. Your error is coming from this line:

transform:'light',
Why are you even using this line when you are providing a store?

suntsu
1 Jul 2009, 8:35 AM
I'm very very sorry... It was so evident ! "this.transform" was in front of me in the debug console... The "transform" propertie is the cause of my problem...

Thanks for your help ! I'll be more carefull next time !

Have nice day !

Nog een keer, veel bedankt ;-)