PDA

View Full Version : 'this.config[...].menuDisabled' is null or not an object



ShatyUT
5 Apr 2010, 1:19 PM
I have a simple GridPanel with one data column and one ItemDeleter column. When I mouse over the header of the data column I get the following error:

'this.config[...].menuDisabled' is null or not an object

This occurs on line 67454 of ext-all-debug.js in Ext JS 3.1. This is in the "isMenuDisabled" method definition and it shows that the variable, col, has a value of -1. I'm guessing that is a problem but not sure why it's value is -1.

Here is the code that generates the GridPanel and related pieces. Does anyone see something I may be doing to cause the problem? I've used all these pieces tons of times without issue so I must be doing something wrong but can't see it.



function displayListWindow(field_label, vals) {
var listWinRsm = new Ext.grid.ItemDeleter({
rowselect: function() {
Ext.getCmp('btnLinksWinSave').enable();
},
rowdeselect: function() {
Ext.getCmp('btnLinksWinSave').enable();
},
deleteRow: function(store, rowIndex, record) {
Ext.Msg.alert('Delete', 'Delete ' + record.get('value') + '?');
}
});
var data = (field_label == 'Collateral Code') ? collateralCodes : documentTypes;
var linksWinStore = new Ext.data.ArrayStore({
fields: [{name: 'id'},{name: 'value'}],
data: data
});
var grid = new Ext.grid.GridPanel({
id: field_label+'grid',
region: 'center',
mode: 'local',
triggerAction: 'all',
columns: [{header: field_label, dataIndex: 'value', id: field_label, sortable: true},
listWinRsm],
autoExpandColumn: field_label,
store: linksWinStore,
sm: listWinRsm
});
var win = new Ext.Window({
title: 'Edit ' + field_label + 's',
layout: 'border',
modal: 'true',
width: 250,
height: 250,
items: [grid,{
xtype: 'form',
region: 'south',
bodyStyle: 'padding: 5px',
height: 32,
border: false,
defaultType: 'textfield',
defaults: {
anchor: '100%'
},
items: [{
fieldLabel: field_label
}]
}],
buttons: [{
text: 'Add'
},{
text: 'Save',
id: 'btnLinksWinSave',
disabled: true
},{
text: 'Cancel',
handler: function() {
win.close();
}
}]
}).show();
var values = vals.split(',');
for (var i = 0; i < values.length; i++) {
listWinRsm.selectRow(linksWinStore.find('value', values[i]), true);
}
}

mpawlowski
5 Apr 2010, 3:08 PM
Your columns definition in grid contains listWinRsm which is of type Ext.grid.ItemDeleter and not of type Ext.grid.Column.

ShatyUT
6 Apr 2010, 6:39 AM
The ItemDeleter component is a column but also extends RowSelectionModel. In order for the related column to show up it has to be included in columns.



Ext.ns('Extensive.grid');

Ext.grid.ItemDeleter = Ext.extend(Ext.grid.RowSelectionModel, {

width: 30,

sortable: false,
dataIndex: 0, // this is needed, otherwise there will be an error

menuDisabled: true,
fixed: true,
id: 'deleterColumn',

initEvents: function(){
Ext.grid.ItemDeleter.superclass.initEvents.call(this);
this.grid.on('cellclick', function(grid, rowIndex, columnIndex, e){
if(columnIndex==grid.getColumnModel().getIndexById('deleterColumn')) {
var store = grid.getStore();
var record = store.getAt(rowIndex);
this.fireEvent('deleterow', store, rowIndex, record);
}
});
this.grid.on('deleterow', this['deleteRow']);
},
deleteRow: function(store, rowIndex, record) {
// When the delete column is clicked it selects the row...we want to undo that
if (this.getSelectionModel().getSelected() == record)
this.getSelectionModel().deselectRow(rowIndex);
store.remove(record);
},
renderer: function(v, p, record, rowIndex){
return '<div class="extensive-remove" style="width: 16px; height: 16px;"></div>';
}
});

ShatyUT
9 Apr 2010, 7:06 AM
I figured it out...the field_label parameter that is passed to displayListWindow was getting a string with a space in it and then I was using that value to specify the "id" config option for a couple pieces.