Hi all, I am trying to create a drilldown organizational chart with jquery and CF… but i was not able to make the visual part… Each supervisor level will have plus.gif/minus.gif that expand/collapse based on click…like windows file system…this query(field -formated_name) gets all correct levels but when it comes to display i could not make it work. Any help appreciated…
<cfquery name="data" datasource="#request.dsn#">
with emp_data as
(select '/'+cast(employee_master_id as varchar(49)) as reporting_path,
employee_master_id
from dbo.employee_master em
where em.employee_master_id = #session.employee_master_id#
union all
select cast(emp_data.reporting_path+'/'+CAST(em.employee_master_id as varchar(4)) as varchar(50)),
em.employee_master_id
from dbo.employee_master em join emp_data on em.supervisor_id = emp_data.employee_master_id
)
select employee_master_id,
employee_master_uuid,
first_name,
last_name,
supervisor_id,
replicate(char(9),((DATALENGTH(reporting_path)-DATALENGTH(REPLACE(reporting_path,'/','')))*2)-2)+last_name+', '+first_name as formated_name,
IsSupervisor=(select case when count(1) > 0 then 'Y' else 'N' end from dbo.employee_master es where es.supervisor_id=result.employee_master_id)
from (select emp_data.reporting_path,
em.employee_master_id,
em.employee_master_uuid,
em.first_name,
em.last_name,
em.supervisor_id
from emp_data join dbo.employee_master em on emp_data.employee_master_id = em.employee_master_id) result
order by reporting_path;
</cfquery>