Prev | Current Page 525 | Next

Frank Zammetti

"Practical DWR 2 Projects"

We then take the row ID passed in and use the getUserData()
method of the dhtmlxGrid component to get the user data value name, which is just the file
name (or directory name) of the selected item in the grid. With those two pieces of information,
plus that system file path separator character we stored during initialization, we can
form a full path to the file or directory and return it.
directoryExpanded() Method
Now we come to a method with a bit more oomph to it, the directoryExpanded() method,
which is called whenever a node in the directory tree is expanded. Its job is to retrieve a list of
directories that are children of the expanded directory and populate the tree with them.
this.directoryExpanded = function(inNodeID, inCurrentState) {
// If the first child is the "Loading" dummy node, we need to load
// the contents of subdirectories of the directory.
var firstNode = directoryTree.getChildItemIdByIndex(inNodeID, 0);
if (firstNode.indexOf("_dummy") != -1) {
var path = directoryTree.getUserData(inNodeID, "path");
FileSystemFunctions.listDirectories(path,
{ callback : function(inResp) {
// Iterate over the collection of DirectoryVO objects returned.
for (var i = 0; i < inResp.


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