将多个项目添加到窗口的Extjs不起作用

时间:2011-08-31 19:45:08

标签: extjs

我有一个像这样定义的小组:

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

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

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

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

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);
        }
    }]
});

我收到错误: 预期':' 当我只在msgDetailsPanel下添加items时,情况正常。 我做错了什么?

1 个答案:

答案 0 :(得分:4)

尝试替换此行:

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

使用:

items: [detailGrid, msgDetailsPanel],