PDA

View Full Version : I don't think singleClickExpand should also collapse



dbassett74
6 Sep 2009, 6:27 AM
Standard Windows behavior for expanding nodes in a tree only expands, but doesn't collapse on a single click. You must double-click to collapse the node. Is there anyway to prevent single click collapse in TreePanel when using singleClickExpand?

KellanStec
6 Sep 2009, 11:38 AM
Set up beforeclick and dblclick listeners on the TreePanel. Return false on the beforeclick handler function and do a node.expand() in the dblclick handler.

dbassett74
7 Sep 2009, 6:52 PM
Set up beforeclick and dblclick listeners on the TreePanel. Return false on the beforeclick handler function and do a node.expand() in the dblclick handler.

Returning false on the beforeclick handler prevents the click event from firing, which prevents the node from getting selected. I still stand by assertion that singleClickExpand should only expand, not collapse, as the very name of the property indicates. There should be another option such as, singleClickCollapse.

KellanStec
7 Sep 2009, 7:19 PM
There is a select() method for nodes.

Since you're canceling all click behavior, you need to replicate the parts of it that you want.