kronox
14 Nov 2007, 8:37 AM
I have already searched through the forums here and could not locate an appropriate solution that would fix the problem I am having.
I am using a layout, which on the west panel I am loading a combo box from an XML file. Everything works fine in FF and loads properly, but in IE7 nothing loads .. actually not even my events to pop up a new panel works in IE7.
I have tried using localXHR, a local webserver, and a hosted webserver. Only browser that I can get the XML to load into the combo boxes, and get the events to fire to pop up the new panel is in FF.
Any ideas?
var clientProperties;
/********************************************************************************
Client Select Options
*********************************************************************************/
var clientNames = new Ext.data.Store({
autoLoad: true,
url: 'clients/clients.xml',
reader: new Ext.data.XmlReader({
record: 'Client',
id: 'id'
}, ['name','company','url','registered','contact','address','city','province','country','postalCode','phone','cell','fax','email']
)
});
function clientSelect(el) {
if(el == null || el == '') el = 'clientSelect';
el = document.getElementById(el);
this.node = document.getElementById('clientSelector'); //document.createElement('select');
var count = 0;
this.node.remove(0);
this.node.add(new Option('-- Select Client --'), null);
for(var i = 0; i < clientNames.getCount(); i++) {
var info = clientNames.getAt(i);
if(info instanceof Ext.data.Record) {
var option = new Option(info.data['name'], info.data['id']);
this.node.add(option, null);
}
}
}
function clientSelected(item) {
var selectedId = item.selectedIndex;
if(selectedId != 0) {
getContracts(item.options[item.selectedIndex].text);
populateProperties(selectedId - 1);
document.getElementById('contractSelector').disabled = false;
} else {
document.getElementById('contractSelector').disabled = true;
populateProperties(-1);
}
}
function populateProperties(index) {
var src = clientProperties.getStore();
var col = clientProperties.getColumnModel();
if(index != -1) var client = clientNames.getAt(index).data;
for(var i = 0; i < src.getCount(); i++) {
var info = src.getAt(i);
if(index != -1) {
if(info.data['name'].match('register') == 'register') info.data['value'] = new Date(Date.parse(client[info.data['name']]));
else info.data['value'] = client[info.data['name']];
} else {
info.data['value'] = '';
}
}
clientProperties.reconfigure(src, col);
}
/*****************************************************************************************
Contract select options
*****************************************************************************************/
var clientContracts;
function getContracts(client) {
clientContracts = null;
var file = 'clients/'+client+'.xml';
clientContracts = new Ext.data.Store({
autoLoad: true,
url: file,
reader: new Ext.data.XmlReader({
record: 'Contract',
id: 'id'
}, ['id','title','phase','lastContact','deadLine','status','hours','invoiceNumber','invoiceTotal','invoiceDeposit','invoiceOwing','invoiceNotes']
)
});
setTimeout('contractSelect()', 1500);
clearContracts();
document.getElementById('contractSelector').add(new Option('-- Loading ...'), null);
}
function clearContracts() {
var s = document.getElementById('contractSelector');
var length = s.length;
for(var i = 0; i < length; i++) {
s.remove(0);
}
}
function contractSelect() {
clearContracts();
this.node = document.getElementById('contractSelector');
var count = 1;
ctabs = new Array();
if(clientContracts.getCount() != 0) {
this.node.add(new Option('-- Select Contract --'), null);
for(var i = 0; i < clientContracts.getCount(); i++) {
var info = clientContracts.getAt(i);
if(info instanceof Ext.data.Record) {
var option = new Option(info.data['title'], info.data['id']);
var id = info.data['id'];
/* add contracts here */
addContractTab(info.data);
this.node.add(option, null);
}
}
this.node.disabled = false;
} else {
this.node.add(new Option('-- No contracts --'), null);
this.node.disabled = true;
}
}
function contractSelected(item) {
document.getElementById('contractName').innerHTML = (item.selectedIndex != 0) ? '<h2>' + item.options[item.selectedIndex].text + '</h2>' : '';
}
/*******************************************************
Contract Information
*******************************************************/
var contractsTab;
function buildContractsTab(index) {
contractsTab = new Ext.TabPanel({
resizeTabs: true,
minTabWidth: 115,
tabWidth: 135,
enableTabScroll: true,
autoWidth: true,
defaults: {autoScroll:true},
// plugins: new Ext.ux.TabCloseMenu()
activeTab: 0,
items: { title: 'Welcome', closable: false, autoLoad: 'welcome.html' }
});
}
function addContractTab(info) {
var ctitle = info['title'];
contractsTab.add(
new Ext.FormPanel({
title: ctitle,
labelWidth: 130,
frame: false,
height: 300,
bodyStyle: 'padding: 1px',
defaults: {width: 230},
closable: true,
items: {
xtype: 'tabpanel',
activeTab: 0,
autoWidth:true,
defaults: {autoHeight:true, bodyStyle:'padding:5px 5px 0'},
items:[{
title: 'Contract Details',
layout: 'form',
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: 'Contract Title',
name: 'title',
value: info['title'],
allowBlank: false
},{
xtype: 'combo',
fieldLabel: 'Contract Phase',
name: 'state',
store: new Ext.data.SimpleStore({
fields: ['phase'],
data: [['Phase 1'],['Phase 2'],['Phase 3'],['Phase 4'],['Phase 5']]
}),
triggerAction: 'all',
mode: 'local',
displayField: 'phase',
valueField: 'phase',
value: info['phase']
},{
xtype: 'combo',
fieldLabel: 'Contract Status',
name: 'status',
store: new Ext.data.SimpleStore({
fields: ['cstatus'],
data: [['Pending Approval'],['Awaiting Payment'],['Payment Past Due'],['Work in Progress'],['Done - Paid'],['Done - Payment Due']]
}),
triggerAction: 'all',
mode: 'local',
displayField: 'cstatus',
valueField: 'cstatus',
value: info['status']
},{
xtype: 'datefield',
fieldLabel: 'Last Contact',
name: 'lastContact',
value: new Date(Date.parse(info['lastContact']))
},{
xtype: 'datefield',
fieldLabel: 'Contract Deadline',
name: 'deadLine',
value: new Date(Date.parse(info['deadLine']))
},{
xtype: 'numberfield',
fieldLabel: 'Hours Worked',
name: 'hours',
value: info['hours']
}]
},{
title: 'Invoice Details',
layout: 'form',
defaults: {width: 230},
defaultType: 'textfield',
items:[{
fieldLabel: 'Invoice Number',
name: 'invoiceNumber',
value: info['invoiceNumber']
},{
xtype: 'numberfield',
fieldLabel: 'Invoice Total',
name: 'invoiceTotal',
value: info['invoiceTotal']
},{
xtype: 'numberfield',
fieldLabel: 'Invoice Deposit',
name: 'invoiceDeposit',
value: info['invoiceDeposit']
},{
xtype: 'numberfield',
fieldLabel: 'Invoice Owing',
name: 'invoiceOwing',
value: info['invoiceOwing']
},{
xtype: 'htmleditor',
width: 350,
enableLists: false,
enableAlignments: false,
enableColors: false,
enableFont: true,
enableFontSize: false,
enableFormat: false,
enableLinks: false,
enableSourceEdit: true,
fieldLabel: 'Invoice Notes',
name: 'invoiceNotes',
value: info['invoiceNotes']
}]
}] },
buttons: [{
text: 'Save',
handler: function(){
alert('saving contract information');
}
}]
})
);
}
function createContractPage(index) {
}
/*******************************************************
Invoice Information
*******************************************************/
var invoiceGrid;
function buildContractInvoiceInformation(index) {
}
/*******************************************************
Property Grid Information
*******************************************************/
var propertyStore;
var propertyColumn;
function createClientProperties() {
clientProperties = new Ext.grid.PropertyGrid({
title: 'Client Information',
closable: false,
source: { 'name' : '','company' : '','url' : '','registered' : '','contact' : '','address' : '','city' : '','province' : '','country' : '','postalCode' : '','phone' : '','cell' : '','fax' : '','email' : '' }
});
}
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
createClientProperties();
buildContractsTab(1);
var clientPropertiesPanel = new Ext.TabPanel({
border: false,
activeTab:0,
tabPosition: 'bottom',
items: clientProperties
});
var viewport = new Ext.Viewport({
layout:'border',
items:[
new Ext.BoxComponent({ // raw
region:'north',
el: 'north',
height:32
}),{
region:'east',
title: 'Client Information',
collapsible: true,
split:true,
width: 300,
minSize: 175,
maxSize: 400,
layout:'fit',
margins:'0 5 0 0',
items:clientPropertiesPanel
},{
region:'west',
id:'west-panel',
title:'Clients/Contracts',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'0 0 0 5',
layoutConfig:{
animate:true
},
items: [{
contentEl: 'west',
border:false,
iconCls:'nav'
}]
}, {
region:'center',
contentEl: 'center',
split:true,
collapsible: true,
title:'Contract Information',
margins:'0 0 0 0',
autoScroll: true,
items: contractsTab
}
]
});
setTimeout('clientSelect(\'clientSelect\')', 1000)
var addWin;
var addButton = Ext.get('addClient');
addButton.on('click', function(){
// create the window on the first click and reuse on subsequent clicks
//if(!addWin){
addWin = new Ext.Window({
title: 'Add a New Client',
layout:'fit',
width:500,
height:300,
closeAction:'hide',
plain: true,
modal: true,
items: new Ext.FormPanel({
labelWidth: 100,
frame: true,
bodyStyle: 'padding:5px 5px 0',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',
items: [
{fieldLabel: 'Client Name', name: 'name', allowBlank: false},
{fieldLabel: 'Client Company', name: 'company', allowBlank: false},
{fieldLabel: 'Client Url', name: 'url', allowBlank: false},
]
}),
buttons: [{
text:'Submit',
handler: function() {
alert('adding new client');
addWin.hide();
// addWin.destroy();
}
},{
text: 'Close',
handler: function(){
addWin.hide();
// addWin.destroy();
}
}]
});
//}
addWin.show(this);
});
});
<html>
<head>
<title>Complex Layout</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript" src="js/clients.js"></script>
<script type="text/javascript" src="js/localXHR.js"></script>
<!--<script language="javascript" src="../grid/PropsGrid.js"></script>-->
<style type="text/css">
html, body {font:normal 12px verdana;margin:0;padding:0;border:0 none;overflow:hidden;height:100%;}
p {margin:5px;}
.settings {background-image:url(ext/shared/icons/fam/folder_wrench.png);}
.nav {background-image:url(ext/shared/icons/fam/folder_go.png);}
select {margin-left:5px;}
</style>
</head>
<body>
<div id="west">
<p>Please select your client.</p>
<div id="clientSelect"><select id="clientSelector" onchange="clientSelected(this);"><option>Loading, please wait ...</option></select></div>
<br><br>
<p id="contractsText" style="display:none">Please select a client from above.</p>
<div id="contractSelect"><select id="contractSelector" onchange="contractSelected(this);" disabled style="display:none;"><option>Select a client from above</option></select></div>
<br><br>
<button id="addClient">Add New Client</button>
</div>
<div id="north">
<p>north - generally for menus, toolbars and/or advertisements</p>
</div>
<div id="center"></div>
<div id="ccontract" style="padding:5px;">
<div id="contractName"></div>
</div>
<div id="cinvoice" style="padding:5px;">
<div id="contractGrid">
<br><br><p><h2>Please select a client/contract from the left.</h2></p>
</div>
</div>
<div id="props-panel" style="width:200px;height:200px;overflow:hidden;">
</div>
<div id="south">
<p>south - generally for informational stuff, also could be for status bar</p>
</div>
</body>
</html>
I am using a layout, which on the west panel I am loading a combo box from an XML file. Everything works fine in FF and loads properly, but in IE7 nothing loads .. actually not even my events to pop up a new panel works in IE7.
I have tried using localXHR, a local webserver, and a hosted webserver. Only browser that I can get the XML to load into the combo boxes, and get the events to fire to pop up the new panel is in FF.
Any ideas?
var clientProperties;
/********************************************************************************
Client Select Options
*********************************************************************************/
var clientNames = new Ext.data.Store({
autoLoad: true,
url: 'clients/clients.xml',
reader: new Ext.data.XmlReader({
record: 'Client',
id: 'id'
}, ['name','company','url','registered','contact','address','city','province','country','postalCode','phone','cell','fax','email']
)
});
function clientSelect(el) {
if(el == null || el == '') el = 'clientSelect';
el = document.getElementById(el);
this.node = document.getElementById('clientSelector'); //document.createElement('select');
var count = 0;
this.node.remove(0);
this.node.add(new Option('-- Select Client --'), null);
for(var i = 0; i < clientNames.getCount(); i++) {
var info = clientNames.getAt(i);
if(info instanceof Ext.data.Record) {
var option = new Option(info.data['name'], info.data['id']);
this.node.add(option, null);
}
}
}
function clientSelected(item) {
var selectedId = item.selectedIndex;
if(selectedId != 0) {
getContracts(item.options[item.selectedIndex].text);
populateProperties(selectedId - 1);
document.getElementById('contractSelector').disabled = false;
} else {
document.getElementById('contractSelector').disabled = true;
populateProperties(-1);
}
}
function populateProperties(index) {
var src = clientProperties.getStore();
var col = clientProperties.getColumnModel();
if(index != -1) var client = clientNames.getAt(index).data;
for(var i = 0; i < src.getCount(); i++) {
var info = src.getAt(i);
if(index != -1) {
if(info.data['name'].match('register') == 'register') info.data['value'] = new Date(Date.parse(client[info.data['name']]));
else info.data['value'] = client[info.data['name']];
} else {
info.data['value'] = '';
}
}
clientProperties.reconfigure(src, col);
}
/*****************************************************************************************
Contract select options
*****************************************************************************************/
var clientContracts;
function getContracts(client) {
clientContracts = null;
var file = 'clients/'+client+'.xml';
clientContracts = new Ext.data.Store({
autoLoad: true,
url: file,
reader: new Ext.data.XmlReader({
record: 'Contract',
id: 'id'
}, ['id','title','phase','lastContact','deadLine','status','hours','invoiceNumber','invoiceTotal','invoiceDeposit','invoiceOwing','invoiceNotes']
)
});
setTimeout('contractSelect()', 1500);
clearContracts();
document.getElementById('contractSelector').add(new Option('-- Loading ...'), null);
}
function clearContracts() {
var s = document.getElementById('contractSelector');
var length = s.length;
for(var i = 0; i < length; i++) {
s.remove(0);
}
}
function contractSelect() {
clearContracts();
this.node = document.getElementById('contractSelector');
var count = 1;
ctabs = new Array();
if(clientContracts.getCount() != 0) {
this.node.add(new Option('-- Select Contract --'), null);
for(var i = 0; i < clientContracts.getCount(); i++) {
var info = clientContracts.getAt(i);
if(info instanceof Ext.data.Record) {
var option = new Option(info.data['title'], info.data['id']);
var id = info.data['id'];
/* add contracts here */
addContractTab(info.data);
this.node.add(option, null);
}
}
this.node.disabled = false;
} else {
this.node.add(new Option('-- No contracts --'), null);
this.node.disabled = true;
}
}
function contractSelected(item) {
document.getElementById('contractName').innerHTML = (item.selectedIndex != 0) ? '<h2>' + item.options[item.selectedIndex].text + '</h2>' : '';
}
/*******************************************************
Contract Information
*******************************************************/
var contractsTab;
function buildContractsTab(index) {
contractsTab = new Ext.TabPanel({
resizeTabs: true,
minTabWidth: 115,
tabWidth: 135,
enableTabScroll: true,
autoWidth: true,
defaults: {autoScroll:true},
// plugins: new Ext.ux.TabCloseMenu()
activeTab: 0,
items: { title: 'Welcome', closable: false, autoLoad: 'welcome.html' }
});
}
function addContractTab(info) {
var ctitle = info['title'];
contractsTab.add(
new Ext.FormPanel({
title: ctitle,
labelWidth: 130,
frame: false,
height: 300,
bodyStyle: 'padding: 1px',
defaults: {width: 230},
closable: true,
items: {
xtype: 'tabpanel',
activeTab: 0,
autoWidth:true,
defaults: {autoHeight:true, bodyStyle:'padding:5px 5px 0'},
items:[{
title: 'Contract Details',
layout: 'form',
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: 'Contract Title',
name: 'title',
value: info['title'],
allowBlank: false
},{
xtype: 'combo',
fieldLabel: 'Contract Phase',
name: 'state',
store: new Ext.data.SimpleStore({
fields: ['phase'],
data: [['Phase 1'],['Phase 2'],['Phase 3'],['Phase 4'],['Phase 5']]
}),
triggerAction: 'all',
mode: 'local',
displayField: 'phase',
valueField: 'phase',
value: info['phase']
},{
xtype: 'combo',
fieldLabel: 'Contract Status',
name: 'status',
store: new Ext.data.SimpleStore({
fields: ['cstatus'],
data: [['Pending Approval'],['Awaiting Payment'],['Payment Past Due'],['Work in Progress'],['Done - Paid'],['Done - Payment Due']]
}),
triggerAction: 'all',
mode: 'local',
displayField: 'cstatus',
valueField: 'cstatus',
value: info['status']
},{
xtype: 'datefield',
fieldLabel: 'Last Contact',
name: 'lastContact',
value: new Date(Date.parse(info['lastContact']))
},{
xtype: 'datefield',
fieldLabel: 'Contract Deadline',
name: 'deadLine',
value: new Date(Date.parse(info['deadLine']))
},{
xtype: 'numberfield',
fieldLabel: 'Hours Worked',
name: 'hours',
value: info['hours']
}]
},{
title: 'Invoice Details',
layout: 'form',
defaults: {width: 230},
defaultType: 'textfield',
items:[{
fieldLabel: 'Invoice Number',
name: 'invoiceNumber',
value: info['invoiceNumber']
},{
xtype: 'numberfield',
fieldLabel: 'Invoice Total',
name: 'invoiceTotal',
value: info['invoiceTotal']
},{
xtype: 'numberfield',
fieldLabel: 'Invoice Deposit',
name: 'invoiceDeposit',
value: info['invoiceDeposit']
},{
xtype: 'numberfield',
fieldLabel: 'Invoice Owing',
name: 'invoiceOwing',
value: info['invoiceOwing']
},{
xtype: 'htmleditor',
width: 350,
enableLists: false,
enableAlignments: false,
enableColors: false,
enableFont: true,
enableFontSize: false,
enableFormat: false,
enableLinks: false,
enableSourceEdit: true,
fieldLabel: 'Invoice Notes',
name: 'invoiceNotes',
value: info['invoiceNotes']
}]
}] },
buttons: [{
text: 'Save',
handler: function(){
alert('saving contract information');
}
}]
})
);
}
function createContractPage(index) {
}
/*******************************************************
Invoice Information
*******************************************************/
var invoiceGrid;
function buildContractInvoiceInformation(index) {
}
/*******************************************************
Property Grid Information
*******************************************************/
var propertyStore;
var propertyColumn;
function createClientProperties() {
clientProperties = new Ext.grid.PropertyGrid({
title: 'Client Information',
closable: false,
source: { 'name' : '','company' : '','url' : '','registered' : '','contact' : '','address' : '','city' : '','province' : '','country' : '','postalCode' : '','phone' : '','cell' : '','fax' : '','email' : '' }
});
}
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
createClientProperties();
buildContractsTab(1);
var clientPropertiesPanel = new Ext.TabPanel({
border: false,
activeTab:0,
tabPosition: 'bottom',
items: clientProperties
});
var viewport = new Ext.Viewport({
layout:'border',
items:[
new Ext.BoxComponent({ // raw
region:'north',
el: 'north',
height:32
}),{
region:'east',
title: 'Client Information',
collapsible: true,
split:true,
width: 300,
minSize: 175,
maxSize: 400,
layout:'fit',
margins:'0 5 0 0',
items:clientPropertiesPanel
},{
region:'west',
id:'west-panel',
title:'Clients/Contracts',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'0 0 0 5',
layoutConfig:{
animate:true
},
items: [{
contentEl: 'west',
border:false,
iconCls:'nav'
}]
}, {
region:'center',
contentEl: 'center',
split:true,
collapsible: true,
title:'Contract Information',
margins:'0 0 0 0',
autoScroll: true,
items: contractsTab
}
]
});
setTimeout('clientSelect(\'clientSelect\')', 1000)
var addWin;
var addButton = Ext.get('addClient');
addButton.on('click', function(){
// create the window on the first click and reuse on subsequent clicks
//if(!addWin){
addWin = new Ext.Window({
title: 'Add a New Client',
layout:'fit',
width:500,
height:300,
closeAction:'hide',
plain: true,
modal: true,
items: new Ext.FormPanel({
labelWidth: 100,
frame: true,
bodyStyle: 'padding:5px 5px 0',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',
items: [
{fieldLabel: 'Client Name', name: 'name', allowBlank: false},
{fieldLabel: 'Client Company', name: 'company', allowBlank: false},
{fieldLabel: 'Client Url', name: 'url', allowBlank: false},
]
}),
buttons: [{
text:'Submit',
handler: function() {
alert('adding new client');
addWin.hide();
// addWin.destroy();
}
},{
text: 'Close',
handler: function(){
addWin.hide();
// addWin.destroy();
}
}]
});
//}
addWin.show(this);
});
});
<html>
<head>
<title>Complex Layout</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
<!-- GC -->
<!-- LIBS -->
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript" src="js/clients.js"></script>
<script type="text/javascript" src="js/localXHR.js"></script>
<!--<script language="javascript" src="../grid/PropsGrid.js"></script>-->
<style type="text/css">
html, body {font:normal 12px verdana;margin:0;padding:0;border:0 none;overflow:hidden;height:100%;}
p {margin:5px;}
.settings {background-image:url(ext/shared/icons/fam/folder_wrench.png);}
.nav {background-image:url(ext/shared/icons/fam/folder_go.png);}
select {margin-left:5px;}
</style>
</head>
<body>
<div id="west">
<p>Please select your client.</p>
<div id="clientSelect"><select id="clientSelector" onchange="clientSelected(this);"><option>Loading, please wait ...</option></select></div>
<br><br>
<p id="contractsText" style="display:none">Please select a client from above.</p>
<div id="contractSelect"><select id="contractSelector" onchange="contractSelected(this);" disabled style="display:none;"><option>Select a client from above</option></select></div>
<br><br>
<button id="addClient">Add New Client</button>
</div>
<div id="north">
<p>north - generally for menus, toolbars and/or advertisements</p>
</div>
<div id="center"></div>
<div id="ccontract" style="padding:5px;">
<div id="contractName"></div>
</div>
<div id="cinvoice" style="padding:5px;">
<div id="contractGrid">
<br><br><p><h2>Please select a client/contract from the left.</h2></p>
</div>
</div>
<div id="props-panel" style="width:200px;height:200px;overflow:hidden;">
</div>
<div id="south">
<p>south - generally for informational stuff, also could be for status bar</p>
</div>
</body>
</html>