Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

SecurityAdmin js tree - what js library?

Go to End



Community Member, 14 Posts

4 January 2011 at 11:40pm

I'm cloning SecurityAdmin and bending it to my own ends, ie editing some custom objects. It's mostly going well. I'm trying to add a little bit of functionality to the nav tree so that when I select an item in the tree to delete it, all its descendants are selected too. Because otherwise they're left in the database as orphans when the ancestor is deleted.

I know I can do it easily in the backend, but I want the selection to happen in the front end because then it's obvious to the user what's happening.

My problem is, what js library (if any) is in use in the tree? I got the selected node, and I've tried prototype functions and jQuery functions on it and they don't exist. So maybe it isn't using them, and maybe I'm just not doing it right? any ideas? Here's a bit of code originally from SecurityAdmin_left.js

    treeSelectionChanged : function(selectedNode) {
		var idx = $('sitetree').getIdxOf(selectedNode);

		if(selectedNode.className.indexOf('nodelete') == -1) {
			if(selectedNode.selected) {
				selectedNode.selected = false;
				deletegroup.selectedNodes[idx] = false;
			} else {
			  // I added the line below and it works
			  alert('select all the children too');

                          // this works too - it displays [HTMLLIElement]

                          //none of these basic prototype calls work "bla bla extend is not a function...."
                          //either together or on their own
                          //basic jquery method call doesn't work "bla bla height is not a function..."

                          //standard DOM methods work fine
                          oDescendants = $('LI');
                          for (var i=0;i<oDescendants.length;i++) alert(oDescendants.item(i).id);

				selectedNode.selected = true;
				deletegroup.selectedNodes[idx] = true;
		return false;