PDA

View Full Version : ExtJS IE7-8 isModel Error



bonbow
12 Aug 2012, 11:02 PM
Hello, I have a script


Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.util.*',
'Ext.state.*'
]);


Ext.create('Ext.data.Store', {
storeId:'TapStateStore',
fields:['name', 'value'],
data:{'items':[
{ 'name': 'Bypass', "value":"Off" },
{ 'name': 'Bridge', "value":"On" },
{ 'name': 'Port In', "value":"On" },
{ 'name': 'Port Out', "value":"On" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.data.Store', {
storeId:'MgmtStore',
fields:['name', 'value'],
data:{'items':[
{ 'name': 'IP', "value":"10.60.7.31" },
{ 'name': 'Netmask', "value":"255.255.255.0" },
{ 'name': 'Gateway', "value":"10.60.0.1" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.data.Store', {
storeId:'DataStore',
fields:['name', 'value'],
data:{'items':[
{ 'name': 'IP', "value":"192.168.0.2" },
{ 'name': 'Netmask', "value":"255.255.255.0" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


var EmailsStore = Ext.create('Ext.data.Store', {
storeId:'EmailsStore',
fields:['email','desc'],
data:{'items':[
{ 'email': 'monitoring@infowatch.com', "desc":"Infowatch Support" },
{ 'email': 'customer@org.com', "desc":"Customer Primary" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.data.Store', {
storeId:'GeneralStore',
fields:['name', 'value'],
data:{'items':[
{ 'name': 'DNS Suffix', "value":"infowatch.ru" },
{ 'name': 'DNS Server 1', "value":"10.10.0.98" },
{ 'name': 'DNS Server 2', "value":"10.10.0.106" },
{ 'name': 'NTP Server 1', "value":"10.10.0.98" },
{ 'name': 'NTP Server 2', "value":"10.60.0.1" },
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.data.Store', {
storeId:'VersionStore',
fields:['name', 'value'],
data:{'items':[
{ 'name': 'DB Schema version', "value":"3.5.3.193" },
{ 'name': 'TM Version', "value":"3.5.3-193" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


var StateGrid = Ext.create('Ext.grid.Panel', {
//title: 'Simpsons',
store: Ext.data.StoreManager.lookup('TapStateStore'),
columns: [
{ text: 'Name', dataIndex: 'name' ,flex:1},
//{ text: 'Value', dataIndex: 'value', flex: 1 },
{
menuDisabled: true,
sortable: false,
xtype: 'actioncolumn',
width: 25,
items: [{
tooltip: '',

getClass: function(v, meta, rec) { // Or return a class from a function
if (rec.get('value') == "On") {
if (rec.get('name') == "Bypass"){
this.items[0].tooltip = 'Up';
return 'warning-col';
} else {
this.items[0].tooltip = 'Up';
return 'ok-col';
}
} else if (rec.get('value') == 'Off') {
if (rec.get('name') == "Bypass"){
this.items[0].tooltip = 'Down';
return 'ok-col';
} else {
this.items[0].tooltip = 'Down';
return 'warning-col';
}
}
}
}]
}
],
height: 200,
width: 400,
hideHeaders: true
});


var DataGrid = Ext.create('Ext.grid.Panel', {
//title: 'Simpsons',
store: Ext.data.StoreManager.lookup('DataStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Value', dataIndex: 'value', flex: 1 }
],
height: 200,
width: 400,
hideHeaders: true
});


var GeneralGrid = Ext.create('Ext.grid.Panel', {
//title: 'Simpsons',
store: Ext.data.StoreManager.lookup('GeneralStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Value', dataIndex: 'value', flex: 1 }
],
height: 200,
width: 400,
hideHeaders: true
});


var VersionGrid = Ext.create('Ext.grid.Panel', {
//title: 'Simpsons',
store: Ext.data.StoreManager.lookup('VersionStore'),
columns: [
{ text: 'Name', dataIndex: 'name' ,flex: 1},
{ text: 'Value', dataIndex: 'value', flex: 1 }
],
height: 200,
width: 400,
hideHeaders: true
});


var MgmtGrid = Ext.create('Ext.grid.Panel', {
//title: 'Simpsons',
store: Ext.data.StoreManager.lookup('MgmtStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Value', dataIndex: 'value', flex: 1 }
],
height: 200,
width: 400,
hideHeaders: true
});


var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 1,
autoCancel: false
});


var EmailGrid = Ext.create('Ext.grid.Panel', {
//title: 'Simpsons',
store: Ext.data.StoreManager.lookup('EmailsStore'),
columns: [
{ text: 'Email', dataIndex: 'email',width:150 },
{ text: 'Desc', dataIndex: 'desc', flex:1 }
],
//height: 200,
//width: 400,
hideHeaders: true,
tbar: [{
text: 'Add Email',
iconCls: 'email-add',
handler : function() {
//rowEditing.cancelEdit();


// Create a model instance
//var r = Ext.create('Email', {
// desc: 'New Guy',
// email: 'new@sencha-test.com',
//});


EmailsStore.insert(0, {"email":"new@sencha-test.com","desc":"sencha-test"});
//rowEditing.startEdit(0, 0);
}
}, {
itemId: 'removeEmployee',
text: 'Remove Email',
iconCls: 'email-remove',
handler: function() {
var sm = EmailGrid.getSelectionModel();
//rowEditing.cancelEdit();
EmailsStore.remove(sm.getSelection());
if (EmailsStore.getCount() > 0) {
sm.select(0);
}
}
//disabled: true
}]
});




var TapState = Ext.create('Ext.panel.Panel', {
title: 'Tap State',
border: 0,
width: 300,
height: 120,
layout:'fit',
margin: '5px 0px 0px 5px',
items: StateGrid
});


var MgmtState = Ext.create('Ext.panel.Panel', {
title: 'Mgmt State',
border: 0,
width: 300,
height: 90,
layout:'fit',
margin: '5px 0px 0px 5px',
items: MgmtGrid
});


var DataState = Ext.create('Ext.panel.Panel', {
title: 'Data State',
border: 0,
width: 300,
height: 70,
layout:'fit',
margin: '5px 5px 5px 5px',
items: DataGrid
});


var GeneralState = Ext.create('Ext.panel.Panel', {
title: 'General State',
border: 0,
width: 300,
height: 150,


layout:'fit',
margin: '5px 0px 0px 5px',
items: GeneralGrid
});


var VersionState = Ext.create('Ext.panel.Panel', {
title: 'Versions',
border: 0,
width: 300,
height: 70,
layout:'fit',
margin: '5px 0px 0px 5px',
items: VersionGrid
});


var EmailState = Ext.create('Ext.panel.Panel', {
title: 'Notify Emails',
border: 0,
width: 325,
height: 130,
layout:'fit',
margin: '5px 0px 0px 5px',
items: EmailGrid
});




var LeftBox = Ext.create('Ext.container.Container', {
layout: {
type: 'vbox'
},
border: 0,
//width: 400,
items: [ TapState, VersionState]
});




var RightBox = Ext.create('Ext.container.Container', {
layout: {
type: 'auto'
},
border: 0,
width: 400,
items: [ GeneralState, MgmtState, DataState]
});




var EmailBox = Ext.create('Ext.container.Container', {
layout: {
type: 'vbox'
},
//flex:1,
//height:170,
//width: 600,
items: [
{
xtype: 'form',
flex:1,
margin: '5px 0px 0px 5px',
//height: 150,
layout: {
type: 'auto'
},
bodyPadding: 10,
items: [
{
xtype: 'fieldset',
//title: 'My Fields',
items: [
{
xtype: 'textfield',
fieldLabel: 'Project name tag',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Relay Server',
anchor: '100%'
}
]
},
{
xtype: 'button',
style: 'float:right',
height: 22,
margin: '0px 0px 0px 5px',
text: 'Test Mail'
},
{
xtype: 'button',
style: 'float:right',
height: 22,
text: 'Apply'
}

]
}
]
});


var NagiosBox = Ext.create('Ext.panel.Panel', {
layout: {
type: 'fit'
},
autoScroll: true,
border: 0,
height: 523,
width: 605,
// collapsed: true,
title: "Nagios",
items: NagiosGrid,
margin: '20px 20px 0px 0px'
});


var NetworkBox = Ext.create('Ext.panel.Panel', {
title: 'Network Settings [<a href="index_blue.html">Blue style</a> | <a href="index.html">Gray style</a>]',
layout: {
type: 'hbox'
},
border: 0,
// width: 400,
items: [LeftBox,
{
xtype:'tbspacer',
width:2
},
RightBox
]
});




var MonitorBox = Ext.create('Ext.panel.Panel', {
title: 'Monitoring Settings',
autoScroll: true,
border: 0,
layout: {
type: 'hbox'
},
flex: 1,
// width: 400,
items: [EmailBox,EmailState]
});


var MainPanel = Ext.create('Ext.panel.Panel', {
//title: 'Main Application Panel',
autoScroll: true,
border: 1,
layout: {
type:'auto'
},
height: 523,
width: 625,
//flex:1,
margin: '20px 10px 20px 30px',
items: [ NetworkBox, MonitorBox]
});


Ext.onReady(function() {
Ext.QuickTips.init();
new Ext.Viewport({
layout: {
type:'hbox'
//align: 'left'
},
//autoScroll: true,
items: [MainPanel,NagiosBox]
});


});


It works fine in Chrome,Firefox,IE9 but it crash in IE8 and IE7 with next error:

SCRIPT5007: Unable to get value of the property 'isModel': object is null or undefined
ext-all.js, string 21 char 452607
extjs version 4.1

@rjun
11 Feb 2013, 6:12 AM
Hi im using Extjs 4.1 getting error "SCRIPT5007: Unable to get value of the property 'isField': object is null or undefined "
on IE7,8,9it works fine in chrome please tell me a solution on this




Thanks
--------------
@rjun

maneljn
27 Mar 2013, 7:56 AM
i have the same problem with error in IE8, but works well in IE9

maneljn
27 Mar 2013, 8:45 AM
bonbow, remove this trailing comma




{ 'name': 'NTP Server 2', "value":"10.60.0.1" },


like this



{ 'name': 'NTP Server 2', "value":"10.60.0.1" }



i have the same problem, and i have found the problem is a trailing comma inside the data of an inline data store definition



columnWidth: 0.5,
name: 'for_nivel[]',
xtype: 'cesiclearablecombobox',
fieldLabel: '<?php echo addslashes(_IDI_NIVELMECU); ?>',
emptyText: '<?php echo addslashes(_IDI_COMBO_LIBRE_EMPTY); ?>',
store: Ext.create('Ext.data.Store', {
model: 'Cesigrup.Curriculums.modeloClaveDescripcion',
data : [
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_1); ?>', descripcion: '' },
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_2); ?>', descripcion: '' },
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_3); ?>', descripcion: '' },
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_4); ?>', descripcion: '' },
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_5); ?>', descripcion: '' },
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_6); ?>', descripcion: '' },
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_7); ?>', descripcion: '' },
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_8); ?>', descripcion: '' },
]
}),
displayField: 'clave',
valueField: 'clave',
queryMode: 'local',
editable: true,
enforceMaxLength: true,
maxLength: 100,
anchor: '100%',
allowBlank: true


The comma of the last record is the problem, i have removed it and error gone.



...
{ clave: '<?php echo addslashes(_IDI_NIVELMECU_8); ?>', descripcion: '' }

jumpow
18 Jul 2013, 10:42 PM
is Model is null or is not object

Context:
extractData : function(root) {
...
for (i = 0; i < length; i++) {
node = root[i];
if (node.isModel) { <-- error here

tvanzoelen
19 Jul 2013, 1:26 AM
maneljn is right. The comma is probably the problem.

zhgeddy
23 Jun 2014, 7:32 PM
Thanks a lot, this really help me !