PDA

View Full Version : EditorGrid doesn't show drop down options



lisson01
15 Jul 2009, 7:05 AM
I have a combobox that is transformed from a dom element. However, when clicked, it doesn't show all options, it is filtered. I compared my code with some samples, but i cant find the differences.


Ext.onReady(function(){

var parameterStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'Admin'}),
reader: new Ext.data.JsonReader({
root: 'items',
id: 'parameterid',
fields: ['parameterid', {name: 'localdeviations', type: 'string'}]
}),
writer: new Ext.data.JsonWriter()
});

this.action = new Ext.ux.grid.RowActions({
header:'',
keepSelection:true,
actions:[{
iconCls:'icon-delete',
tooltip:'Delete parameter',
callback:function(grid, record, action, row, col) {
parameterStore.baseParams = {
action: 'deleteParameter',
parameterid: record.id
};
parameterStore.remove(record);
parameterStore.save();
}
}]
});

getParameters = function(){
parameterStore.reload({params:{action: 'getAllParameters'}});
};

var parameterColumnModel = new Ext.grid.ColumnModel([{
header: "Parameter", width: 80, dataIndex: 'parameterid', editor: new Ext.form.TextField({
allowBlank: true
})},{
header: "Local deviation allowed", width: 120, sortable: true, dataIndex: 'localdeviations',
renderer:function(data){
if(data=="1")
return "Yes";
else
return "No";
},
editor: new Ext.grid.GridEditor(new Ext.form.ComboBox({
typeAhead: true,
lazyRender: true,
transform:'localdeviations',
triggerAction: 'll',
listClass: 'x-combo-list-small'
}))
},
this.action
]);

var parameter = Ext.data.Record.create([
{name: 'parameterid', type: 'string'},
{name: 'localdeviations', type: 'boolean'}
]);

var tbButtonAddParameter = new Ext.Toolbar.Button({
id: 'add-parameter-btn',
minWidth: 80,
text: 'Add Parameter',
iconCls: 'addButton',
disabled: false,
handler: function(){
var p = new parameter({
parameterid: '',
localdeviations: true
});
parameterGrid.stopEditing();
parameterStore.insert(0, p);
parameterGrid.startEditing(0, 0);
}
});

var toolbar = new Ext.Toolbar({
items: [tbButtonAddParameter]
});

var parameterGrid = new Ext.grid.EditorGridPanel({
title: 'Global Parameters',
ds: parameterStore,
cm: parameterColumnModel,
viewConfig: {forceFit: true},
renderTo:'parameter-grid',
width:300,
height:400,
stripeRows:true,
loadMask:true,
tbar: toolbar,
clicksToEdit:1,
plugins:[this.action]
});

getParameters();

parameterStore.on('update', function(store, rec, operation) {
/*if(rec.isModified('parameterid') || rec.isModified('localdeviations')){
connection.request({
url: 'Admin?action=updateParameter',
method: 'POST',
params: {"parameterid": rec.get('parameterid'), "localdeviations": rec.get('localdeviations')},
success: function(responseObject){
var responseJSON = Ext.util.JSON.decode(responseObject.responseText);
if(responseJSON.success){
rec.commit();
getParameters();
} else {
Ext.MessageBox.show({
title: 'Error',
msg: responseJSON.message,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
}
},
failure: function() {
Ext.MessageBox.show({
title: 'Ajax error',
msg: 'HTTP Call failed',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
}
});
}*/
});
});

And the dom element


<select name="localdeviations" id="localdeviations">
<option value="0">No</option>
<option value="1">Yes</option>
</select>

lisson01
16 Jul 2009, 12:13 AM
Anyone?

saJoshua
16 Jul 2009, 12:17 AM
I don't think that you need to use "new Ext.grid.GridEditor":


editor: new Ext.form.ComboBox({
typeAhead: true,
lazyRender: true,
transform:'localdeviations',
triggerAction: 'll',
listClass: 'x-combo-list-small'
})

should work.

See this config from the edit-grid example (http://extjs.com/deploy/dev/examples/grid/edit-grid.html) :



{
header: 'Light',
dataIndex: 'light',
width: 130,
editor: new fm.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform:'light',
lazyRender: true,
listClass: 'x-combo-list-small'
})
}

steffenk
16 Jul 2009, 12:19 AM
triggerAction should read 'all'

lisson01
16 Jul 2009, 9:53 PM
Thanks. After changing the triggerEditor to 'all' (type) the problem was not solved, but after removing the GridEditor within the editor: it works.