PDA

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



rimbaudsolaris
28 Jun 2010, 5:01 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'
}
]

}
]

});


Thanks a lot for your help

rimbaudsolaris
28 Jun 2010, 5:05 AM
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}));

28 Jun 2010, 5:08 AM
This is not a question for Sencha touch. Moving to Ext Help!

rimbaudsolaris
28 Jun 2010, 5:12 AM
Oups Your're right, sorry...

Condor
28 Jun 2010, 5:44 AM
You can't share a selModel between grids, so you can't store it in Defaults. Instead you will have to create the selModel for each grid separately.

ps. This is not only true for the selModel, but for any non-simple type config option.