Understanding The LightSwitch HTML Client Visual Collection RRS feed

  • General discussion

  • To maximize performance, all applications must properly manage the flow of data. When dealing with an entity (one row of data), Visual Studio LightSwitch transfers the entire entity from the data layer to the client, the user interface (UI) layer. When dealing with collections (rows of data) LightSwitch uses Visual Collections, and is very deliberate as to how, and when it places entities in the Visual Collection.

    The Visual Collection API allows the LightSwitch developer the ability to programmatically detect and manage the flow of data.

    LightSwitch team member Huy Nguyen provides the following explanation of the Visual Collection API using a hypothetical Customers collection:

    • screen.getCustomers() will return a Promise object that will be fulfilled when the Customers Visual Collection is loaded. This is the one exposed under Intellisense, because most of the time it's what you want to use.
    • screen.Customers will return the Visual Collection representing the Customers on the screen. This is hidden from Intellisense because when you access it, it's not guaranteed that the Visual Collection is loaded. But it's useful to set up change listener, etc.
    • screen.Customers.data will return an array of all Customers loaded into the Visual Collection.
    • screen.Customer.selectedItem will return the current selected Customer in the Visual Collection.


    The Visual Studio LightSwitch Marketplace


    Thursday, May 23, 2013 2:00 PM