Extjs无法读取属性错误 [英] Extjs cannot read property error

查看:147
本文介绍了Extjs无法读取属性错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了以下extjs代码,但是我收到错误无法读取属性 dom'of null当我添加属性'width'和'height'

但是按钮很好地调整大小,并且表正常工作,但是由于这个错误我的下拉菜单不能正常工作



有人知道如何解决吗?

  div id =tab-content> 
< script type =text / javascript>
Ext.onReady(function(){
Ext.create('BVCore.Grid',{
id:'tab-content',
renderTo:'tab-content' ,
stateId:'tab-content',
store:Ext.create('BVCore.LocalStore',{
fields:['hostName','ip','serialNumber'模型','角色','状态','siteName','installDate','linkedService'],
代理:{
url:'< spring:url value = /json/deviceSearch.json/>'
},
}),
功能:[{ftype:'grouping'}],
列:[
{text:'< spring:message code =device.hostname/>',dataIndex:'hostName',autoSizeColumn:true,align:'center'},
{text:'< spring :message code =device.ipaddress/>',dataIndex:'ip',autoSizeColumn:true,align:'center'},
{text:'< spring:message code =device.sn/>',dataIndex:'serialNumber',autoSizeColumn:true,align:'center'},
{text:'< spring:消息代码=device.model/>',dataIndex:'model',autoSizeColumn:true,align:'center'},
{text:'< spring:message code =device.role />',dataIndex:'role',autoSizeColumn:true,align:'center'},
{text:'< spring:message code =device.status/>',dataIndex:状态',autoSizeColumn:true,align:'center'},
{text:'< spring:message code =device.site/>',dataIndex:'siteName',autoSizeColumn: :'center'},
{text:'< spring:message code =device.installDate/>',dataIndex:'installDate',autoSizeColumn:true,align:'center' $ b {text:'< spring:message code =device.linkedService/>',dataIndex :'linkedService',autoSizeColumn:true,align:'center'},
{autoSizeColumn:true,align:'center',dataIndex:'id',
renderer:function(value,metadata,record ){
var id = Ext.id();
Ext.defer(function(){
Ext.widget('button',{
renderTo:id,
text:'Details',
width:75 ,
height:18,
处理程序:function(){
window.location =/ netmg / controller / home / device / view /+ record.get('id');
}
});
},1);
return Ext.String.format('< div id ={0}>< / div>',id);
}
}
]
});
});
< / script>
< / div>


解决方案

我发现错误感谢这篇文章: p>

https://www.sencha.com/forum/showthread.php?246181-TypeError-el -is-null-el-el.dom-Ext.getDom(el)-in-ext-all-dev.js-(ligne-19839)


I made the following extjs code, but I get the error "cannot read property 'dom' of null" when I add the properties 'width' and 'height'
However the button is well resized and the table is working fine, but cause of this error my dropdown menu doesn't work properly.

Does anybody know how to solve it ?

<div id="tab-content">
<script type="text/javascript">
Ext.onReady(function() {
    Ext.create('BVCore.Grid', {
        id:'tab-content',
        renderTo: 'tab-content',
        stateId: 'tab-content',       
        store: Ext.create('BVCore.LocalStore', {
            fields: ['hostName', 'ip', 'serialNumber', 'model', 'role', 'status', 'siteName', 'installDate', 'linkedService'],
            proxy: {
                url:  '<spring:url value="/controller/search/json/deviceSearch.json" />'               
            },
        }),
        features: [{ftype:'grouping'}],
        columns: [
                  {text: '<spring:message code="device.hostname" />', dataIndex: 'hostName', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.ipaddress" />', dataIndex: 'ip', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.sn" />', dataIndex: 'serialNumber', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.model"/>', dataIndex: 'model', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.role" />', dataIndex: 'role', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.status" />', dataIndex: 'status', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.site" />', dataIndex: 'siteName', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.installDate" />', dataIndex: 'installDate', autoSizeColumn: true, align: 'center'},
                  {text: '<spring:message code="device.linkedService" />', dataIndex: 'linkedService', autoSizeColumn: true, align: 'center'},
                  {autoSizeColumn: true, align: 'center', dataIndex: 'id',
                      renderer: function (value, metadata, record) {
                        var id = Ext.id();
                        Ext.defer(function () {
                            Ext.widget('button', {
                                renderTo: id,
                                text: 'Details',
                                width: 75,
                                height: 18,
                                handler: function () {
                                    window.location = "/netmg/controller/home/device/view/" + record.get('id');
                                }
                            });
                        }, 1);
                        return Ext.String.format('<div id="{0}"></div>', id);
                      }
                  }
              ]
    });
});
</script>
</div>

解决方案

I found the error thanks to this post :

https://www.sencha.com/forum/showthread.php?246181-TypeError-el-is-null-el-el.dom-Ext.getDom(el)-in-ext-all-dev.js-(ligne-19839)

这篇关于Extjs无法读取属性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆