zoukankan      html  css  js  c++  java
  • “Uncaught TypeError: Cannot call method 'createChild' of undefined" 问题的解决

    Uncaught TypeError: Cannot call method 'createChild' of undefined

    我在使用Ext 4.1.1做grid.Panel,然后chrome爆出这么个错误,无法理解,百度谷歌终于改好了

    是这样子的,grid.Panel的整个代码要放到Ext.onReady里面,例如

    Ext.onReady(function(){
         searchProcess();
    
    });

    searchProcess()方法里面写了grid.Panel的全部代码。

    贴一下吧,功能不全,呵呵

    Ext.Loader.setConfig({enabled:true});
    Ext.Loader.setPath('Ext.ux', basePath + 'javascript/extjs/ux');
    Ext.BLANK_IMAGE_URL=basePath + "images/s.gif";
    Ext.require([
        'Ext.grid.*',
        'Ext.data.*',
        'Ext.util.*',
        'Ext.state.*',
        'Ext.ux.grid.FiltersFeature',
        'Ext.toolbar.Paging',
        'Ext.ux.ajax.JsonSimlet',
        'Ext.ux.ajax.SimManager'
    ]);
    
    Ext.define('processRejectDevice', {
        extend:'Ext.data.Model',
        fields:[
            { name:'id', type:'int', mapping:'id', convert:null, defaultValue:undefined},
            { name:'userId', type:'string', convert:null, defaultValue:undefined},
            { name:'finished', type:'string', convert:null, defaultValue:undefined},
            { name:'processType', type:'string', convert:null, defaultValue:undefined},
            { name:'destination', type:'string', convert:null, defaultValue:undefined},
            { name:'initDate', type:'string', convert:null, defaultValue:undefined},
            { name:'reason', type:'string', convert:null, defaultValue:undefined},
            { name:'title', type:'string', convert:null, defaultValue:undefined}
        ],
        idProperty:'id'
    });
    var searchProcess = function () {
    
    Ext.QuickTips.init();
    
    
        Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
    
        var store = Ext.create('Ext.data.Store', {
            model:'processRejectDevice',
            remoteSort:true,
            proxy:{
                //异步获取数据,这里的URL可以改为任何动态页面,只要返回JSON数据即可
                type:'ajax',
                url:'./processSecFile_getProcessByFileid4Ajax.action',
                reader:{
                    root:'items',
                    totalProperty:'total'
                }
            },
            pageSize:20
        });
    
    
    
        store.on('beforeload', function (store, options) {
            var new_params = {fileid:fileId};
            Ext.apply(store.proxy.extraParams, new_params);
        });
    
        //分页组件
        var pagingToolbar = new Ext.PagingToolbar({
            emptyMsg:"没有数据",
            displayInfo:true,
            displayMsg:"显示从{0}条数据到{1}条数据,共{2}条数据",
            store:store
        });
    
    
        var sm = Ext.create('Ext.selection.CheckboxModel');
    
        var grid = Ext.create('Ext.grid.Panel', {
            store:store,
            stateful:true,
            //collapsible: true,
            multiSelect:true,
    
            stateId:'stateGrid',
            bbar:pagingToolbar,
            selModel:sm,
            columns:[
                {dataIndex:'id', text:'流程id', 30, filterable:true, sortable:true },
                {dataIndex:'userId', text:'用id', 100, filterable:true, sortable:true },
                {dataIndex:'finished', text:'是否', 100,  sortable:true, filterable:true},
                {dataIndex:'processType', text:'流程类型', 50,  sortable:true, filterable:true},
                {dataIndex:'destination', text:'destination', 50, sortable:true, filterable:true},
                {dataIndex:'initDate', text:'发起日期', 50,  sortable:true, filterable:true},
                {dataIndex:'reason', text:'发起原因', 100,  sortable:true, filterable:true},
                {dataIndex:'title', text:'标题', 50,  sortable:true, filterable:true}
            ],
            height:400,
            bodyStyle:'100%',
            renderTo:Ext.getBody(),
            forceFit:true,
            viewConfig:{
                stripeRows:true,
                enableTextSelection:true
            }
        });
        store.loadPage(1);
    }

    以上!

  • 相关阅读:
    SQL综合练习(一)
    数据探索及数据处理&文本数据的处理(二)
    数据探索及数据处理&文本数据的处理(一)
    交叉验证cross_validation
    优惠券预测——特征工程
    优惠券预测——数据探索2
    优惠券预测——数据探索1
    C盘扩容
    tracert在网络中的使用
    网络故障篇
  • 原文地址:https://www.cnblogs.com/haitao-fan/p/3174470.html
Copyright © 2011-2022 走看看