PDA

View Full Version : Is it possible to use SelectionModel() with EditorGridPanel ?



rimbaudsolaris
28 Jun 2010, 5:12 AM
I try to use SelectionModel() with EditorGridPanel but it doesn't work

Here the code:





var userExceptionForm = new Ext.grid.EditorGridPanel({

id: 'userExceptionForm',
el: 'userExceptionGridForm-el',
title: 'Title',
frame: true,
labelAlign: 'left',
bodyStyle:'padding:5px',
width: 930,
height: 350,
layout: 'column',
plugins: checkColumn,
cm: colModel,
store: userExceptionStore,

listeners: {

rowselect: function(sm, row, rec) {
Ext.getCmp("userExceptionForm").getForm().loadRecord(rec);

viewready: function(g) {
g.getSelectionModel().selectRow(0);
} // Allow rows to be rendered.
}
},
items: [{columnWidth: 0.60,
layout: 'fit',
items: {
xtype: 'grid',


sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
userExceptionSelectedRow = rec.copy();
Ext.getCmp("userExceptionForm").getForm().loadRecord(rec);
}
}
}),
//autoExpandColumn: 'secondedTo',
height: 350,
width: 580,
title:'<fmt:message key="sybiladmin.userExceptions.list"/>',
border: true,
listeners: {
viewready: function(g) {
g.getSelectionModel().selectRow(0);
} // Allow rows to be rendered.
}
}
},


{
columnWidth: 0.4,
xtype: 'fieldset',
labelWidth: 120,
title:'<fmt:message key="sybiladmin.userException.details"/>',
defaults: {width: 140, border:false}, // Default config options for child items
defaultType: 'textfield',
autoHeight: true,
bodyStyle: Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;',
border: false,
style: {
"margin-left": "10px", // when you add custom margin in IE 6...
"margin-right": Ext.isIE6 ? (Ext.isStrict ? "-10px" : "-13px") : "0" // you have to adjust for it somewhere else
},
items: [{
fieldLabel: 'userLogin',
name: 'userLogin'
},{
fieldLabel: 'Service',
name: 'secondmentToServiceName'
}
]

}
]

});






I try this but it doesn't work.

What's wrong on this snippet ?



Defaults.config.Grid = {
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true,
moveEditorOnEnter: true
})
};

newGrid = new Ext.grid.EditorGridPanel(Ext.apply(Defaults.config.grid,{blah blah blah}));