Opened 10 years ago

Closed 10 years ago

#8532 closed defect (fixed)

[patch][cla] Tree: DND to upperlevel node

Reported by: millennium Owned by: bill
Priority: high Milestone: 1.3
Component: Dijit Version:
Keywords: tree DND Cc:
Blocked By: Blocking:

Description

If you drag an node to an upperlevel, the idents of his child won't be updated. Pure cosmetic :)

in dijit/Tree.js (line: 67) Change:

setIndentAttr: function(indent){
		// summary:
		//		Tell this node how many levels it should be indented
		// description:
		//		0 for top level nodes, 1 for their children, 2 for their
		//		grandchildren, etc.
		this.indent = indent;

		// Math.max() is to prevent negative padding on hidden root node (when indent == -1)
		// 19 is the width of the expandoIcon (TODO: get this from CSS instead of hardcoding)
		var pixels = (Math.max(indent, 0) * 19) + "px";	

		dojo.style(this.domNode, "backgroundPosition",  pixels + " 0px");
		dojo.style(this.rowNode, dojo._isBodyLtr() ? "paddingLeft" : "paddingRight", pixels);
		
	},

To:

setIndentAttr: function(indent){
		// summary:
		//		Tell this node how many levels it should be indented
		// description:
		//		0 for top level nodes, 1 for their children, 2 for their
		//		grandchildren, etc.
		this.indent = indent;

		// Math.max() is to prevent negative padding on hidden root node (when indent == -1)
		// 19 is the width of the expandoIcon (TODO: get this from CSS instead of hardcoding)
		var pixels = (Math.max(indent, 0) * 19) + "px";	

		dojo.style(this.domNode, "backgroundPosition",  pixels + " 0px");
		dojo.style(this.rowNode, dojo._isBodyLtr() ? "paddingLeft" : "paddingRight", pixels);
		
		
		//DND higher level
		dojo.forEach(this.getChildren(), function(child){
			child.attr("indent", indent+1);
		});
		
	},

Change History (3)

comment:1 Changed 10 years ago by bill

Owner: set to bill
Status: newassigned

Ah good catch... if you drag a node to a lower level it's the same problem right (or rather, the opposite problem)?

comment:2 in reply to:  1 Changed 10 years ago by millennium

Replying to bill:

Ah good catch... if you drag a node to a lower level it's the same problem right (or rather, the opposite problem)?

Exactly

comment:3 Changed 10 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [16502]) When draggin and dropping a sub-tree from one node to another, where the source node and target node are at different indentation levels, make sure that the sub-tree's child nodes get the right indentation (in addition to the sub-tree's root getting the right indentation).

Fixes #8532 !strict

Thanks to millennium (CLA on file) for catching the bug and supplying patch.

Note: See TracTickets for help on using tickets.