|
DataSource
Brief overview of the Kuvio DataSource object.
DataSourceThe DataSource object is fairly versatile. At the very least, it contains structured data, like: {
foo : {
bar : "foobar"
}
}Asynchronous DataSource objects need to be passed a valid XHR object (or an object which inherits from KUVIO.connection.XHR). Parameters for the async request/post can be set with DataSource.setParams(obj) where obj is either a JSON string, a set of key/value pairs, or an XML string - depending on the kind of XHR object. Afterwhich, DataSource.update() may be called, which will update the data based on its XHR object. DataSource automatically hooks into the XHR events, so you don't have to worry about them. All you need to worry about, other than setting up the connection correctly, is hooking into the DataSource's onBeginUpdate and onUpdate events. DataSources can be passed around to multiple objects; each one can update the DataSource - or be updated by the DataSource. If you prefer to work directly with the XHR object assigned to the DataSource, you can access it via DataSource.xhr. Manually manipulating it may break other objects that use it, though, so take care. |