Step 3. Modify Add Entry Logic

You need to change the LoadDepts and LoadEmployees routines so that they do not load the next level of the tree.

Secondly, in order to make a level expanding it must have its List.CurrentItem.HasChildren property set to Yes. The tree will then display a small arrow symbol alongside each entry. You need to ensure that departments and employees are expandable. Notes should not be expandable.

Remember: Use F2 on the List control to find these features.

1.  Remove the code which invokes the LoadEmployees method from the LoadDepts method routine.

2.  Remove the code to invoke LoadNotes from the LoadEmployees method routine.

3.  Change the AddEntry method routine to set List.CurrentItem.HasChildren to Yes.

. . .

Add_Entry To_List(#List1)

#List.Currentitem.ParentItem <= #ParentItem

#List.Currentitem.image <= #Image

#List.currentItem.hasChildren := Yes

#Result <= #List.Currentitem

Endroutine

 

     This change will now always set HasChildren to Yes for all list entries. You now need to ensure HasChildren is No for Employee Notes.

4.  Change the LoadNotes method routine so that List.CurrentItem.HasChildren is set to No.

. . .

Selectlist Named(#NotesList) Where(#EmployID = #xEmployeeIdentification)

 

#COM_SELF.AddEntry( #xEmployeeNoteCreateUpdate.AsDisplayString #xEmployeeNote.AsNativeString.trim "" #xImageDetails32 #parent )

#List.CurrentItem.HasChildren := No

Endselect

Endroutine

 

5.  Compile your web page.

6.  Test your web page. Initially departments only are added. Expand any department and employees for this department should be loaded.