Onclick call function

Hello,

I build a Tree from XML and I want to call a function with the Item-ID. The function has the same name as the Item-ID from the tree.

tree.setOnClickHandler(tonclick);

function tonclick(id) {
call_me(tree.getItemText(itemid));
};

function call_me(func)
{
if(typeof func == ‘function’) func()
}

It doesnt’t work with the variable getItemText(itemid). If I call the function call_me(‘createapp’); it works.
Do you have any idea what i do wrong?

Thank you,

Hello,

the parameter of the tonclick is id and you pass itemid to the getItemText method. Try the following:

function tonclick(id) {
call_me(tree.getItemText(id));
};