Disabling the checkbox?

tsugden
Posts: 4
Joined: 2007-07-27

Hello,

Is it easy to disable the checkbox so that the component looks just like a normal tree? The reason for doing this is to make use of the visibleFunction property in a situation where I don't need the checkboxes.

Regards,
Tom

Comments
Teoti
Posts: 172
Joined: 2006-09-04

Hi,

Yes, as you know in the Tree, the model rules the view.

All it would take is a recursive function to loop through the whole tree's model and set the visible field.

But, since I was thinking ahead on this, the Tree has a native function;

public function showChildren(item: Object, visible:Boolean): void

Where the item is the node to make check boxes invisible.

Mike

tsugden
Posts: 4
Joined: 2007-07-27

Hi Mike,

I think you might have misunderstood my question. According to the doc, showChildren() hides all tree items below a specified item. This is not what I want to do. I want to hide the checkbox, but still show the labels the items in the tree. So that the CheckBoxTreeFX looks exactly like a normal Flex Tree. Maybe I can just set the checkButtonRenderer to an IFactory that creates an empty component?

Regards,
Tom

Teoti
Posts: 172
Joined: 2006-09-04

Hi,

Nope. I understood your question, it's that my doc comment on that is to vague. I will update that.

showChildren() means 'toggle all of the children of [node]'s visibleField on or off.

Does that make sense?

Just like the function toggleChildren(), it means 'select all of the children of [node]'s toggleField selected, unselected.

Mike

tsugden
Posts: 4
Joined: 2007-07-27

Hi Mike,

It still doesn't quite make sense... I do not want to toggle the visibility of the node. I simply want to remove the checkbox from the nodes. The node must be visible, but the checkbox invisible. Here is an example to clarify:

The tree must look like this:

> Branch 1
> Branch 2
Leaf 1
Leaf 2

And the tree must *not* look like this:

> [ ] Branch 1
> [ ] Branch 2
[ ] Leaf 1
[ ] Leaf 2

I don't need the checkbox functionality, but would like to make use of the isVisible function to filter a tree.

Best regards,
Tom

Teoti
Posts: 172
Joined: 2006-09-04

Hi,

hehe, Ok, here is the deal.

The visibleField property of the CheckBoxTreeFX relates to the CheckBox in the itemRenderer, not the node.

So when you set the node[visibleField] = false in the model, the tree updates by NOT showing the CheckBox instance in the itemRenderer. This does not hide the node(text, icon).

There is nothing in this component that will hide the actual node, it is saying show or hide the checkbox in the itemRenderer.

Does that make sense?

Mike

tsugden
Posts: 4
Joined: 2007-07-27

Thanks Mike. That makes sense.

essentialtalk
Posts: 1
Joined: 2007-07-31

Perfect, this is what I was looking for too.

However, what is the chance of getting a method in the ICheckBoxTreeDataDescriptor for the purpose of showing/hiding actual nodes. This would be extremely handy and would be a great addition to this component.

Teoti
Posts: 172
Joined: 2006-09-04

Hi,

Actually, that is a good idea.

I am about to release a dock area component and the framework is going to be updated a notch. This means that when I update or add any components, all users get updated versions of all their components so customers that have bought multiple products don't get conflicting framework classes.

Anyway, that said, I will mark this as a todo for that next release.

I also have another bug I am fixing dealing with multiple selection, and selecting multiple items with the checkBoxItemClick event.

... Now that I have thought about this, I actually think this might be hard to implement. The hiding and showing nodes deals with the actual rendering of the tree from the lowlevel and wouldn't have anything to do with the itemRenderer.

But, I haven't tried anything yet so I will get back on this.

Mike

bera
Posts: 1
Joined: 2008-05-10

I always disable the checkbox when it is not need for me.

Privacy Policy | Copyright Notice| Disclaimer| Product EULA
©2003-2008 Teoti Graphix, LLC - All rights reserved.