0

请帮我找到在treepanel ext js的节点内插入html表的解决方案。

找到截图:

在此处输入图像描述

4

1 回答 1

1

这是一个示例:

http://jsfiddle.net/arunv/kGksk/

它应该可以帮助您入门。

分机:

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: "alegrbra", leaf: true}
            ] },
            { text: '<table class="sample_table"><tr><td>11</td><td>12</td></tr><tr><td>21</td><td>22</td></tr></table>', leaf: true }
        ]
    }
});

var tree = Ext.create('Ext.tree.Panel', {
    title: 'Simple Tree',
    useArrows: true,
    width: 500,
    height: 500,
    store: store,
    rootVisible: false,
    renderTo: Ext.getBody()
});

var root = tree.getRootNode();
root.appendChild({ text: '<table class="sample_table"><tr><td>aa</td><td>ab</td></tr><tr><td>ba</td><td>bb</td></tr></table>', leaf: true});

CSS:

.sample_table {
    display: inline-block;
}

.sample_table td {
    border: 1px solid black;
    padding: 5px;
}
于 2013-05-06T21:17:21.670 回答