Example name: WDMF: findAll()
Description: A trivial demonstration of WebORBData Management for Flex (WDMF)'s findAll() method.
Prerequisites:
  • (The as-yet unapproved Your First WDMF Application screencast)
Client-side code: Browse  Download
Server-side code: (All generated and deployed by WebORB)
Feature availability:
  • WebORB for .NET Development Mode
  • WebORB for .NET Community Edition
  • WebORB for .NET Enterprise Edition
Run example:
Key points:
  • All server-side code, wrapping the FoodAndDrinks database, was generated by WebORB, as shown in the prerequisite screencast.
  • WebORB-gnenerated client-side code, in the FAD_Client package of the src package, provides the client-side interface to the server-side database.
  • On the client side, the essential pattern is this:
    • _searchResult is declared to be a bindable ArrayCollection.
    • dataDisplay.dataprovider—the dataprovider property of a Flex DataGrid—is bound to _searchResult. Therefore, whenever _searchResult (or its content) changes, the DataGrid will be updated.
    • The WDMF method findAll() is called. The method returns an instance of ArrayCollection.
      • The returned ArrayCollection is empty, but not null.
      • This empty ArrayCollection instance is returned SYNCHRONOUSLY—that is, immediately—without waiting for the database query to be completed.
      • _searchResult is set to findAll()'s empty result.
    • The database query that is invoked by findAll() is completed ASYNCHRONOUSLY—that is, eventually, long after findAll()'s result is assigned to _searchResult.
    • When the query completes, it populates _searchResult with the database query's completed data.
    • Because dataDisplay.dataprovider is bound to _searchResult, dataDisplay.dataprovider is notified of the change to _searchResult's contents, causing dataDisplay to redraw itself.
  • Most of the action takes place in WebORB's runtime, rather than in application-specific code.
  • Many of WDMF's patterns should be familiar to enterprise developers, if only from Martin Fowler's Patterns of Enterprise Application Architecture.
   
Things to try:
  • Click on a column header in the DataGrid to sort it, then press the Find All Products button again. The sorting information is lost. Why? Extend the sample to retain the DataGrid's sorting across findAll() invocations.
  • Click on the Picture column's header. It is not srtable. Why? How could this be changed? Using what function could picture data be meaningfully sorted?
See also:
Screencast: [none]
Errata:
  • None yet known.