Extjs报错处理
错误信息:
IE:SCRIPT1009: 缺少 '}'
FF:
SyntaxError: identifier starts immediately after numeric literal
..."id100", "statFlag":"0",stepList:[{"id":100step1,"jobId":100,"stepName":"100step...
出现错误的Ext代码:
data:{'total':[
{"id":"100", "jobName":"id100", "statFlag":"0",stepList:[{"id":100step1,"jobId":100,"stepName":"100step1","moniContent":null},{"id":100step2,"jobId":100,"stepName":"100step1","moniContent":null}]},
{"id":"101", "jobName":"id101", "statFlag":"0",stepList:[{"id":101step1,"jobId":101,"stepName":"101step1","moniContent":null},{"id":101step2,"jobId":101,"stepName":"101step1","moniContent":null}]},
{"id":"102", "jobName":"id102", "statFlag":"0",stepList:[{"id":102step1,"jobId":102,"stepName":"102step1","moniContent":null},{"id":102step2,"jobId":102,"stepName":"102step1","moniContent":null}]},
{"id":"103", "jobName":"id103", "statFlag":"0",stepList:[{"id":103step1,"jobId":103,"stepName":"103step1","moniContent":null},{"id":103step2,"jobId":103,"stepName":"103step1","moniContent":null}]}
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'total'
}
错误原因:
json数据中,字符串数据没有用引号
比较而言,FF的错误提示更准确
不知道怎么用Live Writer上传文件,就把完整代码粘上来,相关js,css文件可以去网上下
改正过的代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- EXT -->
<link rel="stylesheet" type="text/css" href="ext4.0/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="ext4.0/shared/example.css" />
<script type="text/javascript" src="common/js/common.js"></script>
<script type="text/javascript" src="ext4.0/bootstrap.js"></script> <script type="text/javascript" src="common/jquery/jquery-1.3.2.min.js"></script> <title>自动化查看</title>
<style type="text/css">
.icon-grid {
background-image:url(ext4.0/shared/icons/fam/grid.png) !important;
}
.icon-clear-group {
background-image:url(ext4.0/shared/icons/fam/control_rewind.png) !important;
} .progress-out{width:300px;height:20px;background:#EEE;}
.progress-in{width:0px; height:20px;background:#AAA;color:white;text-align:center;}
</style>
<script type="text/javascript">
<!--//
jQuery.noConflict();
Ext.Loader.setConfig({
enabled: true
});
Ext.Loader.setPath('Ext.ux', 'ext4.0/ux');
Ext.onReady(function(){ //JOB 模型
Ext.define('Job', {
extend: 'Ext.data.Model',
fields: ['id', 'jobName','statFlag','stepList']
}); function statFlag(val,meta,model,rowIndex,colIndex) {
if (val == 0) {
return '<span style="color:#gray;">未运行</span>';
} else if (val == 1) {
return '<span style="color:#9AD936;">正在执行</span>';
} else if (val == 2) {
return '<span style="color:red;">运行出错</span>';
} else if (val == 3) {
return '<span style="color:red;">告警一次</span>';
}
return val;
}; function stepFlag(val,meta,model,rowIndex,colIndex) {
if(val == null || val == ''){
val = '<span style="color:#gray;">未运行</span>';
}
return val;
}; Ext.create('Ext.container.Viewport', {
layout: 'border',
padding:2,
items: [{
region: 'center',
layout:'border',
border:false,
flex:2,
items:[
{
region:'center',
title:'总数据',
frame:true,
xtype:'grid',
id:'jobGrid',
columns: [{
text: 'ID',
flex: 1,
dataIndex: 'id'
},{
text: '名称',
flex: 1,
dataIndex: 'jobName'
},{
text: '运行状态',
flex: 1,
renderer:statFlag,
dataIndex: 'statFlag'
}],
store:Ext.create('Ext.data.Store', {
// autoLoad:true,
model: 'Job',
data:{'total':[
{"id":"100", "jobName":"id100", "statFlag":"0",stepList:[{"id":"100step1","jobId":"100","stepName":"100step1","moniContent":null},{"id":"100step2","jobId":"100","stepName":"100step1","moniContent":null}]}, {"id":"101", "jobName":"id101", "statFlag":"0",stepList:[{"id":"101step1","jobId":"101","stepName":"101step1","moniContent":null},{"id":"101step2","jobId":"101","stepName":"101step1","moniContent":null}]}, {"id":"102", "jobName":"id102", "statFlag":"0",stepList:[{"id":"102step1","jobId":"102","stepName":"102step1","moniContent":null},{"id":"102step2","jobId":"102","stepName":"102step1","moniContent":null}]}, {"id":"103", "jobName":"id103", "statFlag":"0",stepList:[{"id":"103step1","jobId":"103","stepName":"103step1","moniContent":null},{"id":"103step2","jobId":"103","stepName":"103step1","moniContent":null}]}
]}, proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'total'
}
}
}),
listeners:{
'selectionchange':function(_this,selected,eOpts){
if(selected.length > 0){
Ext.data.StoreManager.lookup('stepStore').loadData(selected[0].get('stepList'))
}
}
} }
]
}, {
region: 'east',
border:false,
hideCollapseTool:true,
collapsible: true,
split: true,
flex:1,
layout:'border',
items:[
{
region:'center',
flex:1,
title:'步骤列表',
frame:true,
xtype:'grid',
columns: [
{ header: 'ID', dataIndex: 'id',flex:1},
{ header: '步骤', dataIndex: 'stepName', flex: 2 },
{ header: '状态', dataIndex: 'moniContent',flex: 2,renderer:stepFlag}
],
store:Ext.create('Ext.data.Store', {
storeId:'stepStore',
fields:['id', 'stepName', 'moniContent','stepKey'],
data:[],
proxy: {
type: 'memory',
reader: {
type: 'json'
}
}
})
}
]
}]
}); }); //--> </script>
</head>
<body> </body>
</html>
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
Extjs报错处理的更多相关文章
- Extjs报错:isField为空或不是对象
在做Extjs开发的时候,有时候会碰到一个奇怪的问题,就是报错说"isField为空或不是对象",经过调试发现是一个数组,显示的长度是21,但是数组里面的个数只有 ...
- ExtJs 4.2.1 报错:Uncaught TypeError: Cannot call method 'getItems' of null
做项目的时候遇到这个问题,搞了一上午终于解决了,让我们看看是什么问题: buttons: [ { text: '保存', icon: '../../../Images/extjs/disk.png', ...
- Java Web项目(Extjs)报错五
1. Java Web项目(Extjs)报错五 具体报错如下: usage: java org.apache.catalina.startup.Catalina [ -config {pathname ...
- Java Web项目(Extjs)报错四
1.Java Web项目(Extjs)报错四 具体报错如下: usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ...
- Java Web项目(Extjs)报错三
1. Java Web项目(Extjs)报错三 具体报错如下: at org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEng ...
- Java Web项目(Extjs)报错二
1.Java Web项目(Extjs)报错二 具体报错如下: usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ...
- Java Web项目(Extjs)报错一
1.Java Web(Extjs)项目报错一 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -no ...
- NetBeans部署项目(Extjs)报错(二)
NetBeans部署项目(Extjs)报错(二) 1.具体错误如下: Using CATALINA_BASE: "C:\Users\Administrator.FOXB2MKB3RGUNIL ...
- NetBeans部署项目(Extjs)报错(一)
NetBeans部署项目(Extjs)报错(一) 1.用NetBeans将项目部署到Tomcat中,报错. 具体如下: ant -f D:\\NetBeans\\workspace\\Foundati ...
随机推荐
- android应用搬家的实现
android手机上的应用搬家功能,具体的介绍和原理参考: 系统目录及应用搬家的研究 应用搬家的实现 这里主要是作为一个补充,因为上面两篇文章虽然讲的挺好的,但是给出的例子不能直接运行,还是需要一些准 ...
- 使用redis实现【统计文章阅读量】及【最热文章】功能
1.视图函数 # 不需要登录装饰器,匿名用户也可访问def article_detail(request, id, slug): # print(slug,id) article = get_obje ...
- asp.net接收传入的数据流
我们在日常的应用中,都会遇到这样一个问题,就是我们做的asp.NET程序,会收到其它第三方软件传过来的一些信息数据流,当然了一些文本形式的信息,可以采用get或post的方法来接收,可是要是传过来的是 ...
- C# 标准事件模式
.NET框架为事件定义了一个标准模式,它的目的是保持框架和用户代码之间的一致性. 标准事件的模式核心是SystemEventArgs——预定义的没有成员的框架类(不同于静态Empty属性) Event ...
- Day44 数据库的操作
视图操作: 1.左连接查询 select * from person left join dept on person.dept_id = dept.did 2. 右连接 3. 内连接 inner ...
- C语言参数传递(值传递、地址传递)+二级指针
参数传递 C语言参数传递一般分为:值传递和地址传递(本质上只有值传递) (注意:C语言中没有引用传递,C++才有引用传递,因为很多C语言环境是用C++编译器编译,使得C看起来支持引用传递,导致很多网上 ...
- 操作实践题 - HTML 列表综合应用
通过对列表的综合应用,编写如下效果网页: 解答: <html> <head> <title>操作实践题</title> <meta http-eq ...
- Kafka数据可靠性与一致性解析
Partition Recovery机制 每个Partition会在磁盘记录一个RecoveryPoint, 记录已经flush到磁盘的最大offset.broker fail 重启时,会进行load ...
- Debian&&ubuntu系安装MegaCli
MegaCli这个命令可以用来监控raid状态.磁盘状况等,最近上了一批ubuntu系统跑openstack,问题是MegaCli在官网上只有rpm格式的包,没有deb的包,但是还是有办法解决的,rp ...
- Jmeter做并发测试(设置集合点)
集合点:让所有请求在不满足条件的时候处于等待状态. 如:我集合点设置为50,那么不满足50个请求的时候,这些请求都会集合在一起,处于等待状态,当达到50的时候,就一起执行.从而达到并发的效果. 那么J ...