• “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);
    }

    以上!

  • 相关阅读:
    MySQL高级【一】索引和视图
    SpringMVC【八】文件上传和下载
    SpringMVC【七】拦截器
    SpringMVC【六】AJAX
    python
    SqlServer优化之批量插入(SqlBulkCopy、表值参数)
    SQL中merge into用法
    Asp.Net MVC Filter权限过滤使用说明 FilterConfig类
    .NET-ORM框架EF-Code First代码优先
    asp.net mvc框架之EF的使用
  • 原文地址:https://www.cnblogs.com/haitao-fan/p/3174470.html
Copyright © 2020-2023  润新知