2016-05-02 18 views
0

嗨我正在为我的项目使用Extjs 6.0.1版本。如何在tabpanel中显示网格面板标题?

需要将网格面板显示到我的项目的选项卡面板中。 我想显示标签面板的特定标签和网格面板的不同标题的一些标题。下面是代码我已经尝试过相同的事情。

1网格面板:

Ext.define('com.SomeName', { 

extend: 'Ext.grid.Panel', 
xtype: 'GridPanelXtype', 
id: 'GridPanel', 
controller: 'GridPanelController', 
title: 'GridPanel <span style ="margin-left: 620px"><img class="Some class" src> Accept</span>', 
flex: 1, 
layout: 'fit', 

columns: [{ 
    header : 'column1', 
    sortable : true, 
    flex:1, 
    menuDisabled: true 
},{ 
    header : 'column2', 
    sortable : true, 
    flex:1, 
    menuDisabled: true 
},{ 
    header: 'column3', 
    flex: 1, 
    sortable: true, 
    format: 'm/d/y', 
    menuDisabled: true 
},{ 
    header: 'column4', 
    flex: 1, 
    sortable: true, 
    menuDisabled: true 
}] 
}); 

第二个标签面板:

Ext.define('com.HomeScreen', { 
extend: 'Ext.form.Panel', 
xtype: 'newHomePage', 
controller: 'tabpanelController', 
items: [{ 
     xtype: 'tabpanel', 
     id: 'advertiseHomeContainer', 
     anchor: '100% 100%', 
     border: 2, 
     layout: 'column', 
     controller: 'tabpanelController', 
     items: [{ 
      id: 'tab1', 
      title: 'Tab Panel title', 
      xtype : 'GridPanelXtype', 
     }], 
}] 
}); 

上面的代码仅显示标签标题(Tab平板标题)和girdpanel与列意味着我不能能显示“GridPanel”(带图片)标题或标题部分。我想在tabpanel内显示标签标题和girdpanel标题。

请告诉我做这件事的方法。

回答

0

标签面板标题必须在tabpanel上定义,而不是在项目上定义。

xtype: 'tabpanel', 
    id: 'advertiseHomeContainer', 
    title: 'Tab Panel title', 
    anchor: '100% 100%', 
    border: 2, 
    layout: 'column', 
    controller: 'tabpanelController', 
    items: [{ 
     id: 'tab1', 
     xtype : 'GridPanelXtype', 
    }], 

Fiddle

根据你的评论,你必须使用overnesting:

xtype: 'tabpanel', 
    id: 'advertiseHomeContainer', 
    anchor: '100% 100%', 
    border: 2, 
    layout: 'column', 
    controller: 'tabpanelController', 
    items: [{ 
     xtype:'panel', 
     title: 'Tab title', 
     items:[{ 
      id: 'tab1', 
      xtype : 'GridPanelXtype', 
     }] 
    }], 

Fiddle

+0

抱歉,我想,我已经误导你还是没能解释你我的问题我更新了我的问题。我想显示标签内的标签标题和网格面板标题。 例如我的标签标题是A,我有B标题的网格,然后我想在标签上显示A,B将在标签内显示为网格标题部分。 –

+0

@AnkitJain我已经更新了我的答案。 – Alexander

相关问题