Hi all,
I want to save actual TreePanel configuration using Ext.data.NodeInterface#serialize method. How to specify node attributes to be serialized? Here is a simple example - I take one from the panels in accordion layout, serialize the structure and create a new panel with the same nodes:
Code:
function _treeSerialize() {
    var tree = Ext.getCmp("_treePanel_system"),
        writer = new Ext.data.writer.Json({
        allDataOptions: {
            persist: false
        },
        writeAllFields: true
    });
 
    var data = tree.getRootNode().serialize(writer);
 
    var store = Ext.create('Ext.data.TreeStore', {
        proxy: {
            type: 'memory',
            reader: {
                type: 'json'
            },
            data: filterObject(data, "loaded")
        }
 
    });
 
    var newPanel = Ext.create('Ext.tree.Panel', {
        id: 'tree',
        rootVisible: false,
        store: store,
        rootVisible: false,
    });
 
    var container = Ext.getCmp("_treeContainer");
    container.add(newPanel);
}
 
function filterObject(obj, key) {
    for (var i in obj) {
        if (!obj.hasOwnProperty(i)) continue;
        if (typeof obj[i] == 'object') {
            filterObject(obj[i], key);
        } else if (i == key) {
            delete obj[key];
        }
    }
    return obj;
}
In order to make it functional, I need to remove "loaded" attribute. Also, to optimize the result, it is useful to omit some other attributes. How to avoid using filterObject() and do it smarter?

Thank you.