PDA

View Full Version : namespace is undefined (RowExpander)



slsb02
13 Jul 2012, 3:24 AM
Hello,

sorry ma English is not good ;-(

I have this Problem:



var test_window = new Ext.create('Ext.Window',{
id: 'test-window',
title: CUS_TEST_WT,
width:740,
height:480,
iconCls: 'window-icon',
closeAction: 'hide',
border: true,
resizable: false,
items: grid
});




var grid = Ext.create('Ext.grid.Panel', {
id: 'this_one',
store: getLocalStore(),
columns: [
{text: "Company", flex: 1, dataIndex: 'company', id: "col1"},
{text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price', id: "col2"},
{text: "Change", dataIndex: 'change', id: "col3"},
{text: "% Change", dataIndex: 'pctChange', id: "col4"},
{text: "Last Updated", renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange', id: "col5"}
],
width: 600,
height: 300,
plugins: [{
ptype: 'rowexpander',
rowBodyTpl : [
'<p><b>Company:</b> {company}</p><br>',
'<p><b>Summary:</b> {desc}</p>'
]
}],
collapsible: true,
animCollapse: false,
title: 'Expander Rows in a Collapsible Grid',
iconCls: 'icon-grid',
});


And the console log "namespace is undefined" i dont have idea what is the Problem?

Best regards

redraid
13 Jul 2012, 3:29 AM
Your require row expander?


Ext.Loader.setConfig({
enabled : true
});


Ext.require([
'Ext.ux.RowExpander'
]);

tvanzoelen
13 Jul 2012, 3:30 AM
RowExpander is probably not loaded because it is part of the ux. So it is not included in the extall file. Include the RowExpander js from the ux folder in a scripttag.

Or require what redraid says...

slsb02
13 Jul 2012, 3:36 AM
sorry,

this is complete Code:



Ext.Loader.setConfig({enabled: true });
Ext.require(['Ext.ux.RowExpander']);

var grid = Ext.create('Ext.grid.Panel', {
id: 'this_one',
store: getLocalStore(),
columns: [
{text: "Company", flex: 1, dataIndex: 'company', id: "col1"},
{text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price', id: "col2"},
{text: "Change", dataIndex: 'change', id: "col3"},
{text: "% Change", dataIndex: 'pctChange', id: "col4"},
{text: "Last Updated", renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange', id: "col5"}
],
width: 600,
height: 300,
plugins: [{
ptype: 'rowexpander',
rowBodyTpl : [
'<p><b>Company:</b> {company}</p><br>',
'<p><b>Summary:</b> {desc}</p>'
]
}],
collapsible: true,
animCollapse: false,
title: 'Expander Rows in a Collapsible Grid',
iconCls: 'icon-grid',
});


an the Result is the same.
In the same File is another window:



Ext.define('MyDesktop.Customers', {
extend: 'Ext.ux.desktop.Module',
requires: ['Ext.ux.RowExpander'],
id:'customers-list-grid-win',
init : function(){
this.launcher = {
text: CUS_DESKTOP_CUSTOMERS_EDIT_ICON,
iconCls:'customers-startmenu-shortcut',
handler : this.createWindow,
scope: this,
}
},
createWindow: function(){...

... plugins: [{
ptype: 'rowexpander',
rowBodyTpl: [...


in "customers-list-grid-win" 'rowexpander' work fine...

I have no Idea...

tvanzoelen
13 Jul 2012, 3:43 AM
put the rowexpander file in the script tag, what happens?

Or else it is an other class it cannot find.

slsb02
13 Jul 2012, 4:13 AM
Thank you for the fast Help!

I put Ext.require(['Ext.ux.RowExpander']);

in my index.html Static Page and rowexpander work fine!


Ext.Loader.setConfig({enabled:true});
Ext.Loader.setPath({
'Ext.ux.desktop': 'js_system',
MyDesktop: ''
});

Ext.require(['Ext.ux.RowExpander']);
Ext.require('MyDesktop.App');