0

I use ExtJS4 Ext.tree.Panel.

I have to append node to my tree grid, so I used NodeInterface.appendChild(). But, the method works very very slow. Probably, because my tree grid has many columns and renderers.

So, I used suppressevents option. And the method works fast. But, I have another problem. TreeStore.getNewRecords() don't work. I can't find the records appended to Node in TreeStore.

1) Handler method codes of [Append] button

var selectedNode = selectionModel.getLastSelected();
for (var i = 0 ; i < len ; i++) {
    selectedNode.appendChild({
        name: 'test name',
        number: i,
        leaf: true
    }, true);       // --> set suppressevents true
}

2) Handler method codes of [Save] button

var treeStore = treeGrid.getStore();
var records = treeStore.getNewRecords();     // --> records.length == 0

How to get new records appended (with suppressevents) to tree node in ExtJS4 ?

4

1 回答 1

0

我找到了一种方法。但是,我认为这不是最好的。

1)使用方法“Ext.data.Tree.registerNode()”

var treeStore = treeGrid.getStore();
var selectedNode = selectionModel.getLastSelected();
for (var i = 0 ; i < len ; i++) {
    selectedNode.appendChild({
        name: 'test name',
        number: i,
        leaf: true
    }, true);       // --> set suppressevents true

    // --> Ext.data.Tree in TreeStore has node hash!
    treeStore.tree.registerNode(newNode, false);
}
于 2013-10-24T23:43:44.860 回答