Hi,
@Override
public Component newContentComponent(String id, IModel<Foo> model)
{
return new Folder<Foo>(id, this, model)
{
/**
* Always clickable.
*/
@Override
protected boolean isClickable()
{
return true;
}
@Override
protected void onClick(AjaxRequestTarget target)
{
Employee employee = getModelObject();
// keep selection somewhere, exchange components or
switch to other page
}
@Override
protected boolean isSelected()
{
// get selected status somewhere
return false;
}
};
}
Have fun
Sven
On 25.09.2015 14:12, Anup wrote:
Sven Meier wrote
a NestedTree does not have any notion of 'selection'.
But the set of expanded nodes is kept in the tree's model object, see
AbstractTree#expand() and #collapse().
You decide how to represent each node's content, for this you'll have to
override AbstractTree#newContentComponent(). The default will just
expand and collapse the tree branches on each click, see
org.apache.wicket.extensions.markup.html.repeater.tree.content.Folder
You can override Folder's methods or use any other component to
represent your nodes.
Thanks Sven. I have understood the above as I can see the expanded nodes by
inspecting tree.getModel(). What still foxes me is how do I take some
action, when the user clicks a particular node? For example if each node is
representing an employee, then how can I display the details of the desired
employee when the user clicks/selects on the corresponding employee node?
Regards,
Anup
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-Tree-Getting-The-Selected-Node-tp4672040p4672042.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]