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>
 
 
 
 
 
 
时间: 2024-09-17 04:18:31

Extjs报错处理的相关文章

extjs报错-extjs中create一个window,里面一个panel加html然后加入buttons就报错了。

问题描述 extjs中create一个window,里面一个panel加html然后加入buttons就报错了. extjs中create一个window,里面一个panel加html然后加入buttons就报错了.代码如: createMapWindows: function() { this.mapWin = Ext.create('Ext.window.Window', { title: '点击获取地理位置', height: 550, width: 700, layout: 'auto'

在myeclipse8.5中加载EXTJS报错

问题描述 在myeclipse8.5中新建项目后,在资源管理器中加入extjs,然后再开发环境中刷新后报错,错误内容如下:"java.lang.StackOverflowError"然后EXTjs中的部分源码中的中文内容变为乱码,不知如何解决,还请各位多多帮忙. 解决方案 解决方案二:引用楼主zzc0527的回复: 在myeclipse8.5中新建项目后,在资源管理器中加入extjs,然后再开发环境中刷新后报错,错误内容如下:"java.lang.StackOverflowE

json-extjs 报错You&amp;amp;#39;re trying to decode and invalid JSON

问题描述 extjs 报错You're trying to decode and invalid JSON IE报错:You're trying to decode and invalid JSON String: {"ganttTask":{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":

ExtJs 4.2.1 报错:Uncaught TypeError: Cannot call method &amp;#39;getItems&amp;#39; of null

做项目的时候遇到这个问题,搞了一上午终于解决了,让我们看看是什么问题: buttons: [ { text: '保存', icon: '../../../Images/extjs/disk.png', handler: function () { if (!formPanel.getForm().isValid()) { return; } formPanel.getForm().submit({ url: '/Manage/SaveArticle', method: 'get', //para

extjs sencha-extj报错IndexOutOfBoundsException: Index: 0, Size: 0

问题描述 extj报错IndexOutOfBoundsException: Index: 0, Size: 0 <!DOCTYPE HTML> <html manifest=""> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="UTF-8"> <title&

sqlserver-EXTJS动态加载树,后台JSP,为什么报错NO DATA FOUND呢?代码在下,多谢了!

问题描述 EXTJS动态加载树,后台JSP,为什么报错NO DATA FOUND呢?代码在下,多谢了! 代码:LoadTree.html test3 <script type="text/javascript"> var tree = new Ext.tree.TreePanel({ loader : new Ext.tree.TreeLoader({ dataUrl : 'tree.jsp?Did=00001' }), border : false, root : new

j uery ajax-jquery 报错提示有未定义

问题描述 jquery 报错提示有未定义 java程序,目的是:遍历Table中的Checkbox,如果被check了,则调用后台FileListServlet中的某个action 初步涉及,写了如下脚本,请问为什么一直报错:Uncaught ReferenceError: $ is not defined $("#btnExecute").click(function(){ $("#tbFileList").find(":checkbox:checked

rownumberer-Extjs4 tabpanel 一个页面关闭后再打开报错

问题描述 Extjs4 tabpanel 一个页面关闭后再打开报错 去年毕业,在公司一直做C/S的软件,最近工作不是很忙,就自己学习了下Extjs4 问题如标题所示.报错信息: TypeError: Argument 1 of Node.insertBefore is not an object. 我是用的desktop + Extjs提供的mvc 做的. 下面贴出部分代码 controller init:function(){ var self=this; coreApp=self; this

GXT 2.1.0 在 GWT 2.0 运行报错.(在使用分页的时候)

2009-12-15 6:27:32 com.google.appengine.tools.development.ApiProxyLocalImpl log SEVERE: [1260858452812000] javax.servlet.ServletContext log: UserInfoService: An IncompatibleRemoteServiceException was thrown while processing this call. com.google.gwt.