【问题标题】:How to add tree panel to a grid panel column in extjs如何将树面板添加到 extjs 中的网格面板列
【发布时间】:2019-06-13 09:26:35
【问题描述】:

我有网格面板。我想在该网格面板中的列中添加一个树面板。

网格面板

Ext.create('Ext.data.Store', {
    storeId: 'simpsonsStore',
    fields:[ 'name', 'email', 'phone'],
    data: [
        { name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1224' },
        { name: 'Bart', email: 'bart@simpsons.com', phone: '555-222-1234' },
        { name: 'Homer', email: 'homer@simpsons.com', phone: '555-222-1244' },
        { name: 'Marge', email: 'marge@simpsons.com', phone: '555-222-1254' }
    ]
});

Ext.create('Ext.grid.Panel', {
    title: 'Simpsons',
    store: Ext.data.StoreManager.lookup('simpsonsStore'),
    columns: [
        { text: 'Name', dataIndex: 'name' },
        { text: 'Email', dataIndex: 'email', flex: 1 },
        { text: 'Phone', dataIndex: 'phone' }
    ],
    height: 200,
    width: 400,
    renderTo: Ext.getBody()
});

树店

var store = Ext.create('Ext.data.TreeStore', {
    root: {
        expanded: true,
        children: [
            { text: 'detention', leaf: true },
            { text: 'homework', expanded: true, children: [
                { text: 'book report', leaf: true },
                { text: 'algebra', leaf: true}
            ] },
            { text: 'buy lottery tickets', leaf: true }
        ]
    }
});

例如, 如果我想将这棵树存储在Name: Lisa 下,即当我们点击 Lisa 时树会展开。我们该怎么做。

谢谢。

【问题讨论】:

    标签: extjs


    【解决方案1】:

    您要搜索的是treegrid

    对于现代工具包,请查看modern treegrid

    对于经典工具包,请检查classic treepanel 的多列。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-01
      • 2011-02-15
      • 2011-08-06
      相关资源
      最近更新 更多