Grid-DataModel


Note: This page is here for historic reasons, the actual information is outdated. See Grid-SPF and Grid-Editing for the actual APIs.


 

4/5/2011 -- I've refactored and built out a better set of samples (over DataSourceSample.html below).  Find these at: http://brado23.github.com/jquery-ui/grid-datamodel2/Default.html.

These samples are meant to be stepped through in your JS debugger, to see the various uses of the "data source" prototype that we've been discussing.

 


Here is a link to the "data source" prototype we've been discussing over the last couple weeks. 

Both UI and non-UI controls (like a pager) can use this as an API to do loading/paging/sorting/filtering over local and remote data.

 

https://github.com/brado23/jquery-ui/blob/borisGrid/grid-datamodel2/DataSourceSample.html

 

This is not a classic request/response API.  Rather, the "data source" manages the contents of the array of data objects to which it is bound, across multiple data read/write operations.

Control or app code will dynamically manipulate query options on the "data source" and call "refresh" on the "data source".

This "refresh" will cause the data source to update the contents of the array to which it is bound.

 

With the separation between "data source" and its array of data objects, jQuery data-linking can relate merely to the array of data objects and can be appropriately unaware of any additional data abstraction.

With in-development enhancements to data-linking, the "data source" should support CUD by listening to both array- and property-changed events, translating these into POSTs.

 

This separation of "data source" from array of data objects has the additional benefit of allowing for a somewhat declarative app construction pattern. 

Notice in the sample that binding between control and data happens at the same, top-level JavaScript scope -- and not in some request/response callback from a data fetch.

 

The "data source" API itself deserves reworking.  I selected the jQuery validator pattern of returning a non-jQuery "data source" object, allowing for fluent chaining of calls on the "data source".

Folks have expressed a desire to change to the jQuery UI pattern of not introducing a non-jQuery object.


Current data model prototype: https://github.com/jquery/jquery-ui/tree/grid/grid-datamodel

 

 


Review of existing implementations: