PDA

View Full Version : Problem splitting file ( outsourcing some code to another file... )



Ericbr
3 Jan 2011, 7:09 AM
Hi,

I tried to follow the tutorial ( http://wwww.extjs.com/learn/Tutorial:Writing_a_Big_Application_in_Ext )
But I do not get it working as I want...

Firebug says:

Angebot is not defined
[Break On This Error] el = DOC.getElementById(id);

It would be cool if anybody can have a look at it:

Thats part of the file I try to get the table in:


<script type="text/javascript" src="<?=base_url()?>/js/own/angebotspos_sub.js"></script>
<script>
Ext.onReady(function() {
var subgrid = new Angebot.Subgrid();
...
},{
columnWidth: .28,
bodyStyle:'padding:5px',
items: [subgrid]
},{
Here is the table (modified Example just for testing):


Angebot.Subgrid = Ext.extend(Ext.grid.GridPanel, {
border:false
,initComponent:function() {
Ext.apply(this, {
height: 350,
width: 600,
store:new Ext.data.ArrayStore({
fields: [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
]
});
columns: [
{
id :'company',
header : 'Company',
width : 160,
sortable : true,
dataIndex: 'company'
},
{
header : 'Price',
width : 75,
sortable : true,
renderer : 'usMoney',
dataIndex: 'price'
},
{
header : 'Change',
width : 75,
sortable : true,
dataIndex: 'change'
},
{
header : '% Change',
width : 75,
sortable : true,
dataIndex: 'pctChange'
},
{
header : 'Last Updated',
width : 85,
sortable : true,
dataIndex: 'lastChange'
}],
,viewConfig:{forceFit:true}
});

Angebot.Subgrid.superclass.initComponent.apply(this, arguments);
} // eo function initComponent

,onRender:function() {
var myData = [
['3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'],
['Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am'],
['Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am'],
['American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am'],
['American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am'],
['AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am'],
['Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am'],
['Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am'],
['Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am']
];


// create the data store
this.store.load();

Angebot.Subgrid.superclass.onRender.apply(this, arguments);
} // eo function onRender
});
Thanks a lot!

Best regards,
Eric

Condor
3 Jan 2011, 8:04 AM
I'm not seeing:

Ext.ns('Angebot');