Prev | Current Page 529 | Next

Frank Zammetti

"Practical DWR 2 Projects"


To accomplish the feat, the code begins by ensuring that a directory is selected. This is
probably not necessary, as there likely is no possibility of this ever occurring, but for the sake
of consistent code, I decided to leave the check in. Besides, as new capabilities are added in
the future, it may be that this becomes a possible situation anyway, so it??™d be nice if the code
was already there to stop the application from breaking.
Anyway, after that check is a call to getUserData() on the tree component to get the path
of the clicked directory. With that information ready, we can proceed to call on the server.
Before that call though, the contents of the grid, if any, are cleared via a simple call to the
grid??™s clearAll() method. Also, we want to have a nice ???Loading...??? message while the contents
are retrieved, so the addRow() grid method is used. You may find the text there a little
funky: ???Loading...,,,???. That??™s actually not a typo: remember that we have four columns in the
file grid, but the loading message is only being put in the first column. We still need to account
for the other three columns though, and that??™s where those commas come in: imagine a value
in between them, and that would be the text put into the other columns in the row, but since
we want no content in them right now, just a list of commas makes everything work.


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