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 ...
随机推荐
- Kafka consumer的参数
earliest: 当各分区下有已提交的offset时,从提交的offset开始消费:无提交的offset时,从头开始消费 latest :当各分区下有已提交的offset时,从提交的offset开始 ...
- C# DataTable导出EXCEL后身份证、银行卡号等长数字信息显示乱码解决
在DataTable导出EXCEL后发现有些格式显示有问题,比如身份证.银行卡号等大于11位的数字显示为科学计数法.13681-1等 带中划线的两段数字显示为日期格式等. 处理方法如下: public ...
- Day14 作业
1,整理今天的博客,写课上代码,整理流程图. 2,用列表推导式做下列小题 (1) 过滤掉长度小于3的字符串列表,并将剩下的转换成大写字母 (2) 求(x,y)其中x是0-5之间的偶数,y是0- ...
- 782. Transform to Chessboard
An N x N board contains only 0s and 1s. In each move, you can swap any 2 rows with each other, or an ...
- 前端入门html(表单)
day48 配置Django项目:https://blog.csdn.net/zV3e189oS5c0tSknrBCL/article/details/79606994 <!DOCTYPE ht ...
- Spring配置项<context:annotation-config>的解释说明
今天在闲逛CSDN论坛时,看到一位博主写的一篇关于<Spring中IOC的Annotation的实现>的文章, 于是点击进去看了下, 发现在说明中对Spring配置文件中的有些配置节点模凌 ...
- 关于省,市,区联动 java 实现方式
关于省,市,区的三级联动后台的实现有两种方式: 1:分三次请求各自取出 省 市 区 的数据: 2:一次请求获得所有的数据,并且组装成相依的数据结构到前端: 其中第一种方式: 会导致数据的延迟加载,出现 ...
- 在.net core Mvc中使用Options和IOptionsSnapshot
1.Startup.cs 下代码 using System; using System.Collections.Generic; using System.Linq; using System.Thr ...
- 解决onclick事件的300ms延时问题
首先是资源的下载:fastclick.js 作为一个新手,插件原理什么的研究不透,看的也是似懂非懂的,网上有很多大牛写的博文相当的好,对于写文章方面确实是望尘莫及啊,所以想详细了解原理的朋友直接去大牛 ...
- git命令上传项目到码云总结
码云上传项目git命令总结: git clone https://git.oschina.net/xh-lxx/xh-lxx.oschina.io.git 进入到克隆下来的文件夹,然后操作git命令 ...