View Full Version : How to dynamically set disableSelection for EditorGridPanel

1 Nov 2010, 2:32 AM
Hi All,

I want to disable my EditorGridPanel for certain case.

I know there is config called disableSelection = true but I want to set it in one of my java script function event

like editorGrid.disableSelection = true or false;

but it does not work. I can't find setDisable() function in API as well. Is there a way to solve this issue?


1 Nov 2010, 2:56 AM
Configure your selection model with disableSelection:false and write a beforerowselect event handler that returns false if the row shouldn't be selected.

1 Nov 2010, 3:30 AM
Hi Condor, thanks for reply. I added beforerowselect event and simply return false but still can edit my date column.

var vaccinationColModel = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), checkColumnVaccination,
{ id: 'DiseaseId', header: "Disease Id", hidden: true, locked: true, dataIndex: 'DiseaseId' },
{ header: "Vaccination", width: 160, sortable: false, dataIndex: 'DiseaseName' },
{ header: "Date Vaccinated", width: 200, sortable: false, dataIndex: 'VaccinationDate', renderer: formatDate, editor: new Ext.form.DateField()}]);

// create the editor grid
var gridvaccination = new Ext.grid.EditorGridPanel({
id: 'grdVaccination',
store: vaccinationStore,
colModel: vaccinationColModel,
plugins: [checkColumnVaccination],
frame: true,
split: true,
autoHeight: true,
autoWidth: true,
clicksToEdit: 1,
enableHdMenu: false,
selModel: new Ext.grid.RowSelectionModel({ singleSelect: true }) //checkColumnVaccination//new Ext.grid.RowSelectionModel({ singleSelect: true })

gridvaccination.getSelectionModel().on('beforerowselect', function (sm, rowIdx, keepExisting, r) {
return false;

1 Nov 2010, 3:40 AM
Editing and selection are not the same thing!

You'll have to write a beforeedit method too that returns false.

2 Nov 2010, 2:17 AM
Thanks Condor. It worked. :)

7 Dec 2010, 8:39 PM
I'm interested in the original topic: dynamically enabling or disabling selection in a List. I tried listening to its "beforeselect" event but nothing happened. What's more, if I do a search through sencha-touch-debug.js for "beforeselect" I don't see anywhere the event is actually fired. Suggestions?

7 Dec 2010, 11:50 PM
You'd better ask this in the Sencha Touch forum section (this forum section is only for Ext JS).