CFOrgChart : Download Available
Just a quick post as I havent posted in ages due to the considerable committments from Teamwork Project Manager
My CFOrgChart demo has gained a huge amount of interest from people and I have unexpectedly been flooded with requests for the code so here it is ;-)
I'll be updating this soon to:
- Use Prototype.js for the AJAX
- Use functions instead of Custom Tags for the recurrsion
- Add more functionality
Comments
P.S. What exactly does the install.exe do?
The install.exe was not meant to be in there! Removed and new package uploaded!
Dan.
Interesting work. I kind of need something like this and I am willing to help build it further. I am kind of new to AJAX but a seasoned CF developer. Let me know if you have another build with the changes you mentioned you might be doing
It works in MS SQL, so you may have to modify for MySQL. I also changed the table and field names for my stuff, but tried to return them to their originals for this code.
DECLARE @list table (nodeId int, done bit)
DECLARE @curNID int <!--- -- current nodeID --->
DECLARE @cnt int <!--- -- a 'should continue' counter --->
SET @curNID = <cfqueryparam value="#url.nodeId#">
INSERT INTO @list VALUES(@curNID, 0)
SET @cnt = 1
WHILE @cnt > 0 BEGIN
<!--- -- get next unprocessed --->
SELECT top 1 @curNID = nodeId
FROM @list
WHERE done <> 1
SET @cnt = @@ROWCOUNT
IF @cnt > 0 BEGIN
<!--- -- this inserts the set of child nodes --->
INSERT INTO @list
SELECT nodeId, 0
FROM nodes
WHERE nodeParentId = @curNID
END
<!--- -- update in the list that it is done --->
UPDATE @list
SET done = 1
WHERE nodeId = @curNID
END
delete from nodes where nodeId in ( select nodeId from @list )