I'm trying to understand something about the onReady() function and building up components. I'm going to try posting some snippets because the complete code is too long.
In my main HTML I'm using this to load my JS:
I originally did it this way to ensure Firefox is loading fresh JS during development but it also works in IE. In the file panel.dashboardPanel.js I have the following (just a snippet):
Both of the items on the panel (panelDashboardCriteria and panelGraphs) are also defined in that file. In my main JS file (tabPanel.main.js) I have the following:
When I load this in Firefox it works perfectly. When I try and run it in IE 7 or 8 I get an error that "dashboardPanel" on the dashboardTab variable declaration is undefined. So I changed panel.dashboardPanel.js to a class and changed my tabPanel.main.js to this:
And it now works in IE and Firefox. What I'm trying to get is why. I'd like to understand WHY this works in both when the former works only in Firefox. My includes are being loaded in the correct order, the dashboardPanel variable is defined in panel.dashboardPanel.js, etc., so why doesn't IE see it in the onReady() function?
Thanks,
Paul
In my main HTML I'm using this to load my JS:
Code:
<script type="text/javascript"> var files = []; files.push('/valenceapps/signetrx/ext/class.DateSelectorPanel.js'); files.push('/valenceapps/signetrx/ext/class.RemainingCreditsPanel.js'); files.push('/valenceapps/signetrx/ext/class.RequestsByCustomerPanel.js'); files.push('/valenceapps/signetrx/ext/class.RequestsByKodakVsNonKodak.js'); files.push('/valenceapps/signetrx/ext/class.RequestsByIndexPanel.js'); files.push('/valenceapps/signetrx/ext/panel.dashboardPanel.js'); files.push('/valenceapps/signetrx/ext/tabPanel.main.js'); // Appends unique time to each filename and writes to browser var refs = []; for (var i = 0; i < files.length; i++) { files[i] += "?" + new Date().getTime(); refs[i] = document.createElement('script'); refs[i].type = 'text/javascript'; refs[i].src = files[i]; document.getElementsByTagName('head')[0].appendChild(refs[i]); } </script>
Code:
var dashboardPanel = new Ext.Panel({ layout: 'border', region: 'center', height: 1500, items: [panelDashboardCriteria, panelGraphs] });
Code:
Ext.onReady(function() { var dashboardTab = new Ext.Panel({ title: 'Dashboard', name: 'dashboardTab', layout: 'fit', items: [dashboardPanel] }); var requestsTab = new Ext.Panel({ title: 'Requests', name: 'requestsTab', layout: 'fit', html: "The requests grid will go here" }); // second tabs built from JS var tabs = new Ext.TabPanel({ //renderTo: document.body, region: 'center', activeTab: 0, plain: true, width: '100%', height: 1500, defaults: { autoScroll: true }, items: [dashboardTab, requestsTab] }); new Ext.Viewport({ layout: 'border', items: [tabs] }); });
Code:
Ext.onReady(function() { var dashboardTab = new Ext.Panel({ title: 'Dashboard', name: 'dashboardTab', layout: 'fit', items: [new SAI.signetrx.panels.DashboardPanel()] // <-- changed line }); var requestsTab = new Ext.Panel({ title: 'Requests', name: 'requestsTab', layout: 'fit', html: "The requests grid will go here" }); // second tabs built from JS var tabs = new Ext.TabPanel({ //renderTo: document.body, region: 'center', activeTab: 0, plain: true, width: '100%', height: 1500, defaults: { autoScroll: true }, items: [dashboardTab, requestsTab] }); new Ext.Viewport({ layout: 'border', items: [tabs] }); });
Thanks,
Paul
Comment