datatable-base.js revision a9469f39cbc0ff8977226a5e0469330341c5186e
1186N/A * The DataTable widget provides a progressively enhanced DHTML control for 1186N/A * displaying tabular data across A-grade browsers. 812N/A * Provides the base DataTable implementation, which can be extended to add 812N/A * additional functionality, such as sorting or scrolling. 812N/A * @submodule datatable-base 812N/A * Base class for the DataTable widget. 812N/A * @class DataTable.Base 1186N/A///////////////////////////////////////////////////////////////////////////// 1186N/A///////////////////////////////////////////////////////////////////////////// 1302N/A///////////////////////////////////////////////////////////////////////////// 1302N/A///////////////////////////////////////////////////////////////////////////// 1302N/A * @description Pointer to Columnset instance. 1302N/A * @type Array | Y.Columnset 1302N/A * @description Pointer to Recordset instance. 1302N/A * @type Array | Y.Recordset 1281N/A * @description Internal state. * @attribute thValueTemplate * @description Tokenized markup template for TH value. * @attribute tdValueTemplate * @description Tokenized markup template for TD value. * @description Tokenized markup template for TR node creation. * @default '<tr id="{id}"></tr>' ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// /*caption: function (srcNode) { ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// * @description Tokenized markup template for TH node creation. * @default '<th id="{id}" rowspan="{rowspan}" colspan="{colspan}" class="{classnames}" abbr="{abbr}"><div class="'+CLASS_LINER+'">{value}</div></th>' * @description Tokenized markup template for TD node creation. * @default '<td headers="{headers}"><div class="'+CLASS_LINER+'">{value}</div></td>' * @description Pointer to THEAD node. * @description Pointer to TBODY node. * @description Pointer to message display node. ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// * @description Converts Array to Y.Columnset. * @param columns {Array | Y.Columnset} * Updates the UI if Columnset is changed. * @method _afterColumnsetChange * @param e {Event} Custom event for the attribute change. if(
this.
get(
"rendered")) {
* @description Converts Array to Y.Recordset. * @param records {Array | Y.Recordset} * Updates the UI if Recordset is changed. * @method _afterRecordsetChange * @param e {Event} Custom event for the attribute change. if(
this.
get(
"rendered")) {
* Updates the UI if summary is changed. * @method _afterSummaryChange * @param e {Event} Custom event for the attribute change. if(
this.
get(
"rendered")) {
* Updates the UI if caption is changed. * @method _afterCaptionChange * @param e {Event} Custom event for the attribute change. if(
this.
get(
"rendered")) {
///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// * @param config {Object} Config object. //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// * Creates and attaches TABLE element to given container. * @param containerNode {Y.Node} Parent node. * Creates and attaches COLGROUP element to given TABLE. * @method _addColgroupNode * @param tableNode {Y.Node} Parent node. // Add COLs to DOCUMENT FRAGMENT * Creates and attaches THEAD element to given container. * @param tableNode {Y.Node} Parent node. * Creates and attaches TBODY element to given container. * @param tableNode {Y.Node} Parent node. * Creates and attaches message display element to given container. * @method _addMessageNode * @param tableNode {Y.Node} Parent node. * Creates and attaches CAPTION element to given container. * @method _addCaptionNode * @param tableNode {Y.Node} Parent node. //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //TODO: is this necessary? //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// * Syncs UI to intial state. * @param val {String} New summary. * @param val {String} New caption. // prepend of remove necessary //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// * @method _uiSetColumnset * @param cs {Y.Columnset} New Columnset. // Iterate tree of columns to add THEAD rows // Column helpers needs _theadNode to exist //this._createColumnHelpers(); // Re-attach THEAD to DOM * Creates and attaches header row element. * @method _addTheadTrNode * @param o {Object} {thead, columns}. * @param isFirst {Boolean} Is first row. * @param isFirst {Boolean} Is last row. * Creates header row element. * @method _createTheadTrNode * @param o {Object} {thead, columns}. * @param isFirst {Boolean} Is first row. * @param isLast {Boolean} Is last row. //TODO: custom classnames * Attaches header row element. * @method _attachTheadTrNode * @param o {Object} {thead, columns, tr}. * Creates and attaches header cell element. * @method _addTheadThNode * @param o {Object} {value, column, tr}. //TODO: assign all node pointers: thNode, thLinerNode, thLabelNode * Creates header cell element. * @method _createTheadThNode * @param o {Object} {value, column, tr}. // Populate template object o.
id =
column.
get(
"id");
//TODO: validate 1 column ID per document // Clear minWidth on hidden Columns if(column.get("hidden")) { //this._clearMinWidth(column); * Attaches header cell element. * @method _attachTheadThNode * @param o {Object} {value, column, tr}. //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// * @method _uiSetRecordset * @param rs {Y.Recordset} New Recordset. var i =
0,
//TODOthis.get("state.offsetIndex") // Replace TBODY with a new one // Iterate Recordset to use existing TR when possible or add new TR * Creates and attaches data row element. * @method _addTbodyTrNode * @param o {Object} {tbody, record} * Creates data row element. * @method _createTbodyTrNode * @param o {Object} {tbody, record} * Attaches data row element. * @method _attachTbodyTrNode * @param o {Object} {tbody, record, tr}. * Creates and attaches data cell element. * @method _addTbodyTdNode * @param o {Object} {record, column, tr}. * Creates data cell element. * @method _createTbodyTdNode * @param o {Object} {record, column, tr}. //TODO: attributes? or methods? * Attaches data cell element. * @method _attachTbodyTdNode * @param o {Object} {record, column, tr, headers, classnames, value}. * Returns markup to insert into data cell element. * @param @param o {Object} {record, column, tr, headers, classnames}.