Click on tree item should load data into a second tree

Hello everyone,
I´m struggling with loading data into another component. In my case I have two trees, and when I click on an item in the one tree it should load the data into the second. This is what I have right now:

// The first tree:
var remoteDirFiles = {
view: “tree”
};

var remoteDirFolders = {
    cols: [
        {  // The second tree:
            view: "tree",
            width: 200,
            url: '/RemoteDir',
            on: {
                onBeforeOpen: function (id) {
                    var fc = String(this.getFirstChildId(id));
                    if (fc.indexOf('/') < 0) {
                        this.remove(fc)
                        this.loadBranch(id);
                    }
                }, 
                onItemClick: function (id) {
                    // And this is unfortunatelly not working:
                    remoteDirFiles.load('/RemoteDir?parent=' + id);
                }
            }
        },
        {view: "resizer"},
        remoteDirFiles    // The first tree is connected to the layout here
    ]
};

var remoteDirTab = {
    view: "tabview",
    cells: [
        {
            header: "Remote Drive",
            body: remoteDirFolders   // Both trees layout is attached here
        }
    ]
};

Hopefully you understand what this is all about. Any hint is highly appreciated.

Thx in advance,
Martin

I figured it out myself. And here is what I did wrong:

  • Had to add an id parmeter to the first tree.
  • Then I had to reference the first tree inside the click-handler of the second tree with the id: $$(“idOfFirstTree”).
  • Now the load function works: $$(“idOfFirstTree”).load(’/RemoteDir?parent=’ + id)

Thx anyway!