• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Runtime-SparseArrays

Page history last edited by Charles Jolley 14 years, 4 months ago
  1. A SparseArray acts like an Array (in that is implements SC.Enumerable and SC.Array), but it populates with content only as needed.
    1. Sparse array's are used most often to implement "incremental loading", where you will present what appears to be a very large array to the rest of the application.  But in reality you will only load a portion of the array data from the server when it is actually requested.
    2. You can use Sparse Array's anytime you have a large dataset that you want to display in the UI but it would be too expensive to setup the array contents up front.
  2. Using a SparseArray
    1. To use a sparse array, you simply need to implement a SparseArray delegate.  A delegate is a third party object that is given some control over the SparseArray.  It is how SproutCore allows you to implement custom control of an object without having to build a subclass.
    2. Your delegate will be notified anytime the array needs to load some data.  You must then provide the array with this data.  You can provide the data immediately or asynchronously.

Comments (0)

You don't have permission to comment on this page.