PDA

View Full Version : Grid Problem with ext 3.3 with CheckboxSelectionModel



ladro1987
13 Oct 2010, 5:39 AM
Hi all,
I have update at last extjs version my project.
All right exept the CheckboxSelectionModel of my grids.

If I click on the checkbox, FireFox show this error: "this.grid is undefined"
Explorer show this error "this.grid.store is null or isn't object".

this is the code:



var store_bounces;
var grid_bounces;
var grid_bounces_ColumnModel;
var sel_prov_iscritto;
var sel_com_iscrittoi;
var sel_cap_iscritto
var win_create_iscritto;
var ArgomentoField;
var ct;

Ext.onReady(function(){

/* Preload Applicazione */
setTimeout(function(){
Ext.get('loading').remove();
Ext.get('loading-mask').fadeOut({remove:true});
}, 1000);

Ext.BLANK_IMAGE_URL = '../../ext/resources/images/default/s.gif';//ing GIF

/* Posizionamento messaggio d'errore */
Ext.form.Field.prototype.msgTarget = 'under';
/* Lunghezza dei campi */
Ext.form.Field.prototype.style = 'width:80%;';
/* Separatore dei label */
//Ext.form.Field.prototype.labelSeparator='∗ :';

Ext.QuickTips.init();

/* Grid Iscritti ColumnModel */
grid_bounces_ColumnModel = new Ext.grid.ColumnModel(

[
new Ext.grid.RowNumberer({width: 30}),
new Ext.grid.CheckboxSelectionModel(),
{
header: 'Id Contatto',
readOnly: true,
dataIndex: 'id_contatto',
renderer: function(value, cell){
cell.css = "readonlycell";
return value;
},
hidden: true
},{
header: 'Nome Struttura',
readOnly: true,
dataIndex: 'nome_struttura',
id:'nome_struttura',
sortable:true
},{
header: 'Email',
dataIndex: 'email_rifiuto',
id:'email',
width:250,
sortable:true,
editor: new Ext.form.TextField({
allowBlank: false,
blankText:'L\'<b>email</b> &egrave; un campo obbligatorio.',
vtype:'email',
vtypeText:'L\'<b>email</b> inserita &egrave; errata.'
}),
renderer: function(value, cell){
cell.css = "coolcell";
return value;
}
},{
header: 'Data Rifiuto',
readOnly: true,
width:250,
dataIndex: 'data_rifiuto'

}]
);
grid_bounces_ColumnModel.defaultSortable = true;
/* Grid Iscritti */
grid_bounces = new Ext.grid.EditorGridPanel({
id: 'IscrittiListingEditorGrid',
store: store_bounces,
enableColLock:false,
animCollapse: true,
columnLines: true,
bufferResize: true,
autoWidth:true,
autoHeight:true,
clicksToEdit:2,
title:'',
frame:true,
footer:false,
autoExpandColumn: 'nome_struttura',
selModel: new Ext.grid.CheckboxSelectionModel(),
style: 'padding-top:5px;',
cm: grid_bounces_ColumnModel,
bbar: new Ext.PagingToolbar({
pageSize: 30,
store: store_bounces,
displayInfo: true,
displayMsg: 'Ritorni Visualizzati <b>{1}</b> di <b>{2}</b>',
emptyMsg: '<b>Non sono presenti ritorni.</b>',
plugins: new Ext.ux.SlidingPager()
}),
tbar: [{
iconCls:'delete',
text: 'Cancella Selezionati',
tooltip:'Cancella gli iscritti selezionati',
tooltipType: 'qtip',
handler: conferma_cancella_iscritti
},'-',{
text: 'Cerca:',
tooltip:'Inserisci il <b>nome del template</b> o una parte della parola che intendi cercare',
tooltipType: 'qtip'
},new Ext.app.SearchField({
emptyText: 'Cerca...',
loadingText: 'Ricerca...',
store: store_bounces,
params: {
start: 0,
limit: 30
},
width: 120
})
],
viewConfig:{
forceFit:true
},
view: new Ext.ux.grid.BufferView({
rowHeight: 20,
scrollDelay: true
})
});
grid_bounces.on('afteredit', aggiorna_email);

store_bounces.load({params: {start: 0, limit: 30}});

grid_bounces.render('form_render');

});
I see any thread but I don't understand the problem!!

Help me plz! Thanks:-/:-/
Roberto

Condor
13 Oct 2010, 5:50 AM
You need to use the SAME CheckboxSelectionModel for both the column and the selModel config!

(I'm surprised this worked on any Ext version!)

ladro1987
13 Oct 2010, 6:15 AM
Infact is the "selModel config" that i don't understand! :-(

Condor
13 Oct 2010, 6:23 AM
The selection model is used to keep track of which rows are selected. In case of a CheckboxSelectionModel, the same class can be used as a column to display the checkbox.

Example:

var csm = new Ext.grid.CheckboxSelectionModel(); // <- only ONE!
var grid = new Ext.grid.GridPanel({
...
selModel: csm, // <- use here
columns: [
csm, // <- and here
...
]
});

ladro1987
14 Oct 2010, 12:23 AM
Okkkk! All Right!!
Works perfectly!! Thank you Condor!!