parent section

How to get parent section of scheduler in tree timeline view?

Hi,

do you need to find a parent section using a child section ID ?

Yes, I do need

You can find the section using recursion and return the parent element:

[code]function getParentSection(childId){
var sections = scheduler.matrix[scheduler._mode].y_unit_original;
var parent = null;
var oldParent = null;
var parentId = null;

var getChildren = function(sections){
	for(var i=0; i<sections.length; i++) {
		if(sections[i].key == childId && sections[i].level == 0)
			return null;
		if(sections[i].key == childId && parent){
			parentId = parent.key;
			break;
		}
		if(sections[i].children){
			oldParent = parent;
			parent = sections[i];
			getChildren(sections[i].children);
			parent = oldParent;
		}
	}
}
getChildren(sections);
return parentId;

}[/code]