Topic: Checkboxes have different behavour after upgrade

I had to upgrade to the latest mif-tree.

On a checkbox tree, previously if I clicked a parent node (with the tree opened to show the children) it would only check the parent.

Now if I click the parent all the children are checked as well.

I don't know if it was as a result of the upgrade of mif-tree or some other change to my code that I did at the same time.

Is the operation of this something that can be configured?

Regards
Icydee

Re: Checkboxes have different behavour after upgrade

The code that used to work has the following

initialize: function(){
    this.initCheckbox('partial', 'id', tFormField);
},

and I note that in my original copy of mif-tree, Mif.Tree.Checkbox.js it checked for type=='partial' but that this is missing in the latest version.

Has this functionality been removed?

Or re-thinking this. I took over this project from another programmer. I wonder if it is something that he did and he modified the code directly?

If so may-be you would be interested in a patch?

Last edited by icydee (2009-04-11 20:27:02)

Re: Checkboxes have different behavour after upgrade

Sorry to pollute your message board but as is often the case, sometimes you think of the answer after you have posted a question!

I checked back through our source-code repository and found that the previous programmer (may he rot in hell!) had made modifications to the original mif-tree code rather than extending it!

Anyway, the functionality I have may be of interest to you so I will try to explain it.

[img]checkboxes.gif[/img]

The idea is that clicking a parent does not check all children (as the 'simple' option works I believe)

Clicking a child however will check all parents (but put them in a 'disabled' mode)

This is for use in the circumstance where it only makes sense for children to be checked if all ancestors are also checked.

Re: Checkboxes have different behavour after upgrade

A further enhancement appears to be as follows.

The checked tree object is used to replace a select list that is within a form.

When the form is submitted, a call to a new method, makeFormElements, is made which will inject 'input' elements into the form and give them the name of the select list and a value for each of the tree elements which is checked.

This allows the server to process the checked items in the mif-tree as if they were items from a multi-select list.

Again, I can offer you this code when I have tidied it up.

Re: Checkboxes have different behavour after upgrade

this is something very very specific, i'm not interesting in this code.

Re: Checkboxes have different behavour after upgrade

OK, so the 'partial' checking of checkboxes I can understand as being rather specific.

How about where a checkbox tree is put in a form to replace (for example) a multi-select select list or other list of options?

I don't see anything in your code to ensure that when the form is submitted, the checked items are sent in the POST or GET parameters.

I can't see that this is 'very-very' specific. Quite a few people must be doing this.

But hey, it's your code you can do what you want (or not) with it.

Re: Checkboxes have different behavour after upgrade

i'm never think that some one will use tree inside form.