PDA

View Full Version : Issue with ext-all-debug.js



lguzman
9 Sep 2010, 1:18 PM
Hello everyone

i get an error in ext-all-debug.js when trying to open a component in Desktop sample:



MyDesktop.PG= Ext.extend(Ext.app.Module, {
id:'PG-id',

init : function(){
this.launcher = {
text: ' Client',
iconCls:'grid-win',
handler : this.createWindow,
scope: this
}
},

createWindow : function(){
var desktop = this.app.getDesktop();
var win = desktop.getWindow(this.id);
if(!win){
var pg = new MyEditorGridUi();

win = desktop.createWindow({
id: this.id,
title:'The Client',
width:300,
height:500,
iconCls: 'grid-win',
shim:false,
animCollapse:false,
border:false,
constrainHeader:true,

layout: 'fit',
items: pg
});
}
win.show();
}
});


i get this error:
Uncaught TypeError: Cannot call method 'getSortState' of undefined

i manage to get it work surronding with try and catch in the ext-all-debug.js file

have someone ever got this error, is there something wrong in my code?

thaks everyone!!!

Condor
10 Sep 2010, 1:11 AM
I assume that this is an error in MyEditorGridUi, of which you didn't post any code.

lguzman
10 Sep 2010, 5:51 AM
Hello

I didn't post any code because i did it with ext designer, but here it is:


MyEditorGridUi = Ext.extend(Ext.grid.EditorGridPanel, {
title: 'My Grid',
width: 400,
height: 250,
initComponent: function() {
this.columns = [
{
xtype: 'gridcolumn',
dataIndex: 'string',
header: 'Column',
sortable: true,
width: 100,
editor: {
xtype: 'textfield'
}
},
{
xtype: 'numbercolumn',
dataIndex: 'number',
header: 'Column',
sortable: true,
width: 100,
align: 'right',
editor: {
xtype: 'numberfield'
}
},
{
xtype: 'datecolumn',
dataIndex: 'date',
header: 'Column',
sortable: true,
width: 100,
editor: {
xtype: 'datefield'
}
},
{
xtype: 'booleancolumn',
dataIndex: 'bool',
header: 'Column',
sortable: true,
width: 100,
editor: {
xtype: 'checkbox',
boxLabel: 'BoxLabel'
}
}
];
MyEditorGridUi.superclass.initComponent.call(this);
}
});

Thank you

Condor
10 Sep 2010, 6:08 AM
Your grid doesn't have a store!

lguzman
10 Sep 2010, 6:18 AM
Yes i know the grid is useless, i did it just for trying the desktop, but when i try it, i got an error in ext-all-debug.js wich i had to surrond with a try - catch statment, this is what i change in ext-all-debug.js:

code start in line 44601 of extjs 3.2.1


updateHeaderSortState : function(){
var state = null;
try {
state = this.ds.getSortState();
}
catch(err){}
if (!state) {
return;
}

Condor
10 Sep 2010, 6:23 AM
'this.ds' is the grid store, which you didn't define, so this.ds.getSortState() will throw an exception.

lguzman
10 Sep 2010, 6:34 AM
Ok, i get your point, is just that this example grid did work outside the desktop example.

sorry for the newbie question and i really apriciate your help.

Thanks!!!!