Extjs将多个项目添加到窗口不起作用 [英] Extjs adding multiple items to a window does not work

查看:103
本文介绍了Extjs将多个项目添加到窗口不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样定义的面板:

I have a panel defined like this:

var msgDetailsPanel = new Ext.ux.ManagedIFrame.Panel({
    title: 'M',
    header: true,
    width:700,
    height:200,
    autoScroll: true
});

我有一个这样定义的网格:

And I have a Grid defined like this:

var detailGrid = new Ext.grid.GridPanel({
    id:'detailGrid',
    store: dataStore,
    collapsible: false,
    columnLines: false,
    enableHdMenu: false,
    header: false,
    cm: new Ext.grid.ColumnModel({
        defaults: {
            sortable: true
        },
        {id:'msgId',hidden: true, dataIndex: 'msgId'},                    
        {sortable: true, dataIndex: 'deliveryAddr'},
        {sortable: true, dataIndex: 'deliveryDate'},
        {sortable: true, dataIndex: 'status', renderer:function(value, p, record){
            return String.format( '<font color="009966">{0}</font>', value );}},
        {header: 'info',xtype: 'templatecolumn',tpl: '<a href="#"  onClick = "alert({msgId})">View Message Details</a>'}  
    }),
    viewConfig: {
        forceFit:true
    },
    columnLines: false,
    frame:false,
    collapsible: false,
    animCollapse: false,
    title: alertName,
    disableSelection: true,
    deferRowRender:false
});

现在我想将这两个组件添加到窗口中.

Now I want to add these two components to a window.

win = new Ext.Window({
    layout:'fit', 
    title: '<spring:message code="title.alertDetails" />',
    autoDestroy: true,
    autoScroll: true,
    width:600,
    height:400,
    closable:false,
    plain: true,
    items: [{detailGrid}, {msgDetailsPanel}],//This is where error comes
    buttons: [{
        text: '<spring:message code="label.button.close" />',
        handler: function(){
            win.hide(this);
        }
    }]
});

我收到错误消息: 预期为':'
当我仅在items下添加msgDetailsPanel时,一切正常. 我在做什么错了?

I get error: Expected ':'
When I am adding only the msgDetailsPanel under items, things work fine. What am I doing wrong?

推荐答案

尝试替换此行:

items: [{detailGrid}, {msgDetailsPanel}],

具有:

items: [detailGrid, msgDetailsPanel],

这篇关于Extjs将多个项目添加到窗口不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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