Skip to content

ssambi/Dojo-CheckboxTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Dojo CheckboxTree

Extension of dijit.Tree widget with checkboxes, using ForestStoreModel. Tested with dojotoolkit 1.7.

Example

See test.html as an example with CDN loading and AMD format.

require([
		"dojo/dom", 
		"my_ext/CheckboxTree", // "dijit/Tree", 
		"dojo/data/ItemFileWriteStore", 
		"my_ext/CheckboxForestStoreModel", // "dijit/tree/ForestStoreModel", 
		"dijit/form/Button",
		"dojo/domReady!"
		], function(dom, Tree, ItemFileWriteStore, ForestStoreModel, Button) {
		
			var treeData = {
				'identifier': 'name',
				'label' : 'description',
				'items' : [
					{ 'name' : 'node1', 'description' : 'node1', 'checked' : true },
					{ 'name' : 'node2', 'description' : 'node2', 'children' : [
						{ 'name' : 'node3', 'description' : 'node3', 'checked' : false },
						{ 'name' : 'node4', 'description' : 'node4', children : [
							{ name : 'node5', description : 'node5', checked : true },
							{ name : 'node6', description : 'node6' }
						]}
					]},
					{ 'name' : 'node7', 'description' : 'node7 description', 'checked' : true },
			]};

			var treeStore = new ItemFileWriteStore({ data : treeData });
			var treeModel = new ForestStoreModel({
					store: treeStore,
					childrenAttrs: ["children"]
				});
			var tree = new Tree({
					id : "tree",
					model : treeModel,
					showRoot : false,
					openOnClick : false,
					setCheckboxOnClick : true
				},
				'treeDiv');
			tree.startup();
			
			...
			
		});

About

Extension of dijit.Tree widget with checkboxes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published