datatable-datasource.js revision 54d173830317b5b4b08bca6b521354692cbc4b83
/**
* Plugs DataTable with DataSource integration.
*
* @module datatable
* @submodule datatable-datasource
*/
/**
* Adds DataSource integration to DataTable.
* @class DataTableDataSource
* @extends Plugin.Base
*/
function DataTableDataSource() {
}
/////////////////////////////////////////////////////////////////////////////
//
// STATIC PROPERTIES
//
/////////////////////////////////////////////////////////////////////////////
Y.mix(DataTableDataSource, {
/**
* The namespace for the plugin. This will be the property on the host which
* references the plugin instance.
*
* @property NS
* @type String
* @static
* @final
* @value "datasource"
*/
NS: "datasource",
/**
* Class name.
*
* @property NAME
* @type String
* @static
* @final
* @value "dataTableDataSource"
*/
NAME: "dataTableDataSource",
/////////////////////////////////////////////////////////////////////////////
//
// ATTRIBUTES
//
/////////////////////////////////////////////////////////////////////////////
ATTRS: {
/**
* @attribute datasource
* @description Pointer to DataSource instance.
* @type Y.DataSource
*/
datasource: {
setter: "_setDataSource"
},
/**
* @attribute initialRequest
* @description Request sent to DataSource immediately upon initialization.
* @type Object
*/
setter: "_setInitialRequest"
}
}
});
/////////////////////////////////////////////////////////////////////////////
//
// PROTOTYPE
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// ATTRIBUTE HELPERS
//
/////////////////////////////////////////////////////////////////////////////
/**
* @method _setDataSource
* @description Creates new DataSource instance if one is not provided.
* @param ds {Object | Y.DataSource}
* @returns Y.DataSource
* @private
*/
_setDataSource: function(ds) {
},
/**
* @method _setInitialRequest
* @description Sends request to DataSource.
* @param request {Object} DataSource request.
* @private
*/
_setInitialRequest: function(request) {
},
/////////////////////////////////////////////////////////////////////////////
//
// METHODS
//
/////////////////////////////////////////////////////////////////////////////
/**
* Initializer.
*
* @method initializer
* @param config {Object} Config object.
* @private
*/
initializer: function(config) {
}
},
////////////////////////////////////////////////////////////////////////////
//
// DATA
//
////////////////////////////////////////////////////////////////////////////
/**
* Load data by calling DataSource's sendRequest() method under the hood.
*
* @method load
* @param config {object} Optional configuration parameters:
*
* <dl>
* <dt>request</dt><dd>Pass in a new request, or initialRequest is used.</dd>
* <dt>callback</dt><dd>Pass in DataSource callback object, or the following default is used:
* <dl>
* <dt>success</dt><dd>datatable.onDataReturnInitializeTable</dd>
* <dt>failure</dt><dd>datatable.onDataReturnInitializeTable</dd>
* <dt>scope</dt><dd>datatable</dd>
* <dt>argument</dt><dd>datatable.getState()</dd>
* </dl>
* </dd>
* <dt>datasource</dt><dd>Pass in a new DataSource instance to override the current DataSource for this transaction.</dd>
* </dl>
*/
};
if(ds) {
}
},
/**
* Callback function passed to DataSource's sendRequest() method populates
* an entire DataTable with new data, clearing previous data, if any.
*
* @method onDataReturnInitializeTable
* @param e {Event.Facade} DataSource Event Facade object.
*/
onDataReturnInitializeTable : function(e) {
}
});