PDA

View Full Version : Problem loading ext-base - Total newbie



davisty
10 Nov 2010, 6:09 AM
Hello,

Ive updated to 3.3.0 and Im getting a javascript error from the ext-base.js saying window.undefined is not defined. It's the very first line of code in base.

Firebug reports
window.undefined=window.undefined; is not a function.
My js includes are
<script type="text/javascript" src="js/ext-base.js (http://www.sencha.com/forum/view-source:http://dev.sencha.com/deploy/ext/adapter/ext/ext-base.js)"></script>
<script type="text/javascript" src="Js/ext-all.js (http://www.sencha.com/forum/view-source:http://dev.sencha.com/deploy/ext/ext-all-debug.js)"></script>

Im sure Ive done something wrong, Can someone please help.

Im a kinda newbie at this, Im using extjs because JS leaves me with a blank stare.
If that gives you any idea.

Thanks in advance.

Condor
10 Nov 2010, 6:48 AM
Never seen that error before...

Are you sure you uploaded the files correctly to your server?

davisty
10 Nov 2010, 7:14 AM
Im not sure. I found the ext-base in the adapter folder. Is that the correct one?

Condor
10 Nov 2010, 7:24 AM
You want ext/adapter/ext/ext-base.js and not ext/source/adapter/ext-base.js.

davisty
10 Nov 2010, 7:39 AM
Thats the one Im using. The file size is 26KB. Is that correct?

In what order should the ext-all and ext-base files be listed in the includes? Or does it matter?

I cant post a screen shot. The document is too large.


file:///C:/DOCUME%7E1/user/LOCALS%7E1/Temp/moz-screenshot-2.png

Condor
10 Nov 2010, 7:44 AM
1. Size sounds OK.
2. ext-base.js should come before ext-all.js.
3. Upload the image to imageshack.us and post the link here.

Maybe you should try including ext-base-debug.js to get more detailed error message.

davisty
10 Nov 2010, 8:42 AM
Sorry it took so long ...

http://img143.imageshack.us/img143/2272/extbaseerror.jpg

davisty
10 Nov 2010, 10:14 AM
It might help if I posted the code. Im basically cloning the grid to form drag and drop example. Instead of the mydata variable, Im using a JsonStore to receive the data. The grid portion is working and displaying. The form element is not displaying and Im receiving the ext-base error message.

This code is written for an IBM System i, so you might see some elements that your not familiar.



/$top
Content-type: text/html
Expires: 0

<html>
<head>
<title>Drag and Drop - Example</title>

<link rel="stylesheet" type="text/css" href="/js/ext-all.css" />
<script type="text/javascript" src="/JS/ext-base-debug.js"></script>
<script type="text/javascript" src="/JS/ext-all-debug.js"></script>

<script type="text/javascript">
Ext.onReady(function(){
Ext.QuickTips.init();

// create the data store
var gridStore = new Ext.data.JsonStore({
autoLoad: true,
url: 'EXTJS99R.PGM',
root: 'NANDA',
fields: [
'nacust',
'naname',
'naadr1',
'naadr2',
'nacity',
'nastat',
'nazip'
]});

// Generic fields array to use in both store defs.
var fields = [
{name: 'nacust', mapping : 'nacust'},
{name: 'naname', mapping : 'naname'},
{name: 'naadr1', mapping : 'naadr1'},
{name: 'naadr2', mapping : 'naadr2'},
{name: 'nacity', mapping : 'nacity'},
{name: 'nastat', mapping : 'nastat'},
{name: 'nazip', mapping : 'nazip'}
];

// Column Model shortcut array
var cols = [
{ header: "Cust No.", sortable: true, dataIndex: 'nacust'},
{header: "Name", dataIndex: 'naname'},
{header: "Adr1", dataIndex: 'naadr1'},
{header: "Adr2", dataIndex: 'naadr2'},
{header: "City", dataIndex: 'nacity'},
{header: "St", dataIndex: 'nastat'},
{header: "Zip", dataIndex: 'nazip'}
];

// declare the source Grid
var grid = new Ext.grid.GridPanel({
ddGroup : 'gridDDGroup',
store : gridStore,
columns : cols,
enableDragDrop : true,
stripeRows : true,
region : 'west',
title : 'Data Grid',
selModel : new Ext.grid.RowSelectionModel({singleSelect : true})
});

// Declare the text fields. This could have been done inline, is easier to read
// for folks learning :)
var nacust = new Ext.form.TextField({
fieldLabel : 'Cust No.',
name : 'nacust'
});

var naname = new Ext.form.TextField({
fieldLabel : 'Name',
name : 'naname'
});

var naadr1 = new Ext.form.TextField({
fieldLabel : 'Adr1',
name : 'naadr1'
});

var naadr2 = new Ext.form.TextField({
fieldLabel : 'Adr2',
name : 'naadr2'
});

var nacity = new Ext.form.TextField({
fieldLabel : 'City',
name : 'nacity'
});

var nastat = new Ext.form.TextField({
fieldLabel : 'St',
name : 'nastat'
});

var nazip = new Ext.form.TextField({
fieldLabel : 'Zip',
name : 'nazip'
});


// Setup the form panel
var formPanel = new Ext.form.FormPanel({
region : 'center',
title : 'Generic Form Panel',
bodyStyle : 'padding: 10px; background-color: #DFE8F6',
labelWidth : 100,
width : 325,
items : [
nacust,
naname,
naadr1,
naadr2,
nacity,
nastat,
nazip
]
});

//Simple 'border layout' panel to house both grids
var displayPanel = new Ext.Panel({
width : 650,
height : 300,
layout : 'border',
renderTo : 'panel',
items : [
grid,
formPanel
],
bbar : [
'->', // Fill
{
text : 'Reset Example',
handler : function() {
//refresh source grid
gridStore.loadData(grid);
formPanel.getForm().reset();
}
}
]
});


// used to add records to the destination stores
var blankRecord = Ext.data.Record.create(fields);

/****
* Setup Drop Targets
***/

// This will make sure we only drop to the view container
var formPanelDropTargetEl = formPanel.body.dom;

var formPanelDropTarget = new Ext.dd.DropTarget(formPanelDropTargetEl, {
ddGroup : 'gridDDGroup',
notifyEnter : function(ddSource, e, data) {

//Add some flare to invite drop.
formPanel.body.stopFx();
formPanel.body.highlight();
},
notifyDrop : function(ddSource, e, data){

// Reference the record (single selection) for readability
var selectedRecord = ddSource.dragData.selections[0];

// Load the record into the form
formPanel.getForm().loadRecord(selectedRecord);

return(true);
}
});


});
</script>
</head>
<body>
<div id="panel"></div>
</body>
</html>