Prev | Current Page 527 | Next

Frank Zammetti

"Practical DWR 2 Projects"

This method will get the subdirectories, starting at the
directory specified by the path parameter.
Upon return from this method, we begin to iterate over the collection of DirectoryVOs
returned, one for each child directory (if any). For each, we construct a unique node ID to
represent the directory in the tree, and we then use the insertNewChild() method of the
dhtmlxTree component to add a node for the directory. The setUserData() method is also
used to store the actual path of the directory on the node for later use.
Next, we check the value of the hasChildren flag on the DirectoryVO. If it??™s true, that
means the subdirectory itself has child directories, in which case we add a ???Loading??? node to
it so that when the user expands it, it works just like every other directory, initially showing
???Loading...??? while the subdirectories for it are retrieved. Finally, we call the closeItem()
method on the tree component, passing it the ID of the node we just added. This is necessary
because the node would be expanded now due to it having a child node, which isn??™t what we
want here.
The last step involved is to delete the ???Loading??? node in the selected directory.


Pages:
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539