Foren

TreeView Checkbox On Parent with JSON

thumbnail
Tom Mahy, geändert vor 12 Jahren.

TreeView Checkbox On Parent with JSON

Regular Member Beiträge: 103 Beitrittsdatum: 11.05.11 Neueste Beiträge
Hi,

Im trying to create a treeview where you can select (with a checkbox) the parent and that the children are selected aswell.
Here it shows a working example : http://alloy.liferay.com/demos.php?demo=treeview

However i am unable to reproduce this.

The json

[{ "type" : "check", "checkName": "10435|7Cogs, Inc.", "label": "7Cogs, Inc.", "leaf" : false , "children" : [ { "type" : "check", "checkName": "10760|7Cogs, Inc. Mobile", "label": "7Cogs, Inc. Mobile", "leaf" : true } ] },{ "type" : "check", "checkName": "17702|organisation 1", "label": "organisation 1", "leaf" : true },{ "type" : "check", "checkName": "17708|organisation 2", "label": "organisation 2", "leaf" : true }]


AUI().use('aui-tree', function(A){
		var tree = new A.TreeView({
			type: 'file',
			boundingBox: '#tree_tags_node',
			children: data
			}).render();				
});


If i remove the child node from the parent node everything works but once i add the field "children" then i get an error :

invalid 'in' operand config
[Break On This Error] userTargets = (config && BUBBLETARGETS in config); 


I have also tried this with type : task but its the same result.
Any idea what im doing wrong ?
thumbnail
Tom Mahy, geändert vor 12 Jahren.

RE: TreeView Checkbox On Parent with JSON

Regular Member Beiträge: 103 Beitrittsdatum: 11.05.11 Neueste Beiträge
bump
Pavel Bigarov, geändert vor 12 Jahren.

RE: TreeView Checkbox On Parent with JSON

New Member Beitrag: 1 Beitrittsdatum: 08.03.12 Neueste Beiträge
I have the same issue.
Is there way to solve the problem?
Thanks.
nicolas fuentes, geändert vor 9 Jahren.

RE: TreeView Checkbox On Parent with JSON

New Member Beitrag: 1 Beitrittsdatum: 24.05.14 Neueste Beiträge
I had the same issue. What I've done is to set type:"checkbox" only for the elements in the last level (not in any parent element).
For example:

'[
{"id":"modulo_", "label":"aaa","expanded":true, "type":"","cache":true,
	children: [{"id":"rubro_", "label":"aaa","expanded":true, "type":"","cache":true,
                            children: [
                              {"id":"tarea_", "label":"aaa","expanded":true, "type":"check","cache":true},
                              {"id":"tarea_", "label":"aaa","expanded":true, "type":"check","cache":true}
                            ]
         }] 
 }]'


Hope it can help some one.