Prev | Current Page 528 | Next

Frank Zammetti

"Practical DWR 2 Projects"

Once that??™s
done, the callback is finished, and the tree is fully updated.
directoryClicked() Method
The directoryClicked() method is the next method you encounter as you walk through the
Fileman class, and its job is to display the contents of a directory when the user clicks it in the
directory tree.
this.directoryClicked = function(inNodeID) {
// Make sure a directory is selected.
if (inNodeID == null || inNodeID == "") {
return;
}
CHAPTER 6 n REMOTELY MANAGING YOUR FILES: DWR FILE MANAGER 300
// Get path of clicked directory.
var path = directoryTree.getUserData(inNodeID, "path");
// Clear grid and put in loading message.
fileGrid.clearAll();
fileGrid.addRow("rowLoading", "Loading...,,,,");
FileSystemFunctions.listFiles(path,
{ callback : function(inResp) {
fileGrid.deleteRow("rowLoading");
// Iterate over the collection of FileVO objects returned.
for (var i = 0; i < inResp.length; i++) {
// For each, add a row to the grid.
fileGrid.addRow(i + inResp[i].name, inResp[i].name + "," +
inResp[i].size + "," + inResp[i].type + "," +
inResp[i].modified);
fileGrid.setUserData(i + inResp[i].name, "name", inResp[i].name);
}
}
}
);
} // End directoryClicked().


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