PDA

View Full Version : How to set combo in PropertyGrid



venu
21 May 2009, 2:13 AM
I just going through the PropertyGrid example came with Ext 3.0.

I am trying to add a Combo box to the Property Grid but it is not working.

Here is my code
------------------


Ext.onReady(function(){
var propsGrid = new Ext.grid.PropertyGrid({
el:'props-grid',
nameText: 'Properties Grid',
width:300,
autoHeight:true,
viewConfig : {
forceFit:true,
scrollOffset:2 // the grid will never have scrollbars
}
});

propsGrid.render();

var comboCategory = new Ext.form.ComboBox({
fieldLabel : 'Category',
name : 'category',
allowBlank : false,
store : ['Business', 'Personal'],
typeAhead : true,
mode : 'local',
triggerAction: 'all'
});

propsGrid.setSource({
"(name)": "Properties Grid",
"grouping": false,
"autoFitColumns": true,
"productionQuality": false,
"created": new Date(Date.parse('10/15/2006')),
"tested": false,
"version": 0.01,
"borderWidth": 1,
"Category": new Ext.grid.GridEditor(new Ext.form.TextField({
allowBlank : true
}))
});

});
But the Category field is not displayed and also i see no error.

Anyone let me know where i am going wrong?

Thanks,
venu

21 May 2009, 3:35 AM
source is meant for a name : value data set.

venu
21 May 2009, 5:21 PM
Thanks for reply.
Is there any example of setting the combo in the PropertyGrid?

venu
25 May 2009, 7:32 PM
SOLVED.

Here is the solution for adding combo and check box to the PropertyGrid.



Ext.onReady(function(){
var comboCategory = new Ext.form.ComboBox({
fieldLabel : 'Category',
name : 'category',
allowBlank : false,
store : ['Business', 'Personal'],
typeAhead : true,
mode : 'local',
triggerAction : 'all',
emptyText :'-- Select category --',
selectOnFocus :true
});

var active = new Ext.form.Checkbox({
name : 'active',
fieldLabel : 'Active',
checked : true,
inputValue : '1'
});

var propsGrid = new Ext.grid.PropertyGrid({
el:'props-grid',
nameText: 'Properties Grid',
width:300,
autoHeight:true,
viewConfig : {
forceFit:true,
scrollOffset:2 // the grid will never have scrollbars
},
customEditors: {
'Category': new Ext.grid.GridEditor(comboCategory),
'Active' : new Ext.grid.GridEditor(active)
}
});

propsGrid.render();

propsGrid.setSource({
"(name)": "Properties Grid11",
"grouping": false,
"autoFitColumns": true,
"productionQuality": false,
"created": new Date(Date.parse('10/15/2006')),
"tested": false,
"version": 0.01,
"borderWidth": 1,
"Category": 'Personal',
"Active" : true
});
});

floppy
18 May 2010, 1:31 AM
The propsGrid.setSource() that you do in your code doesn't seem to have any relationship with the rest of your code.

Eugene88
1 Sep 2010, 3:22 AM
Where is it possible to find
Ext.grid.GridEditor?