datatable-base.js revision 8947d1099a91880ec4e5be929041b1cebb9a3a55
DATATABLE = "datatable",
FOCUS = "focus",
KEYDOWN = "keydown",
MOUSEOVER = "mouseover",
MOUSEOUT = "mouseout",
MOUSEUP = "mouseup",
MOUSEDOWN = "mousedown",
CLICK = "click",
DOUBLECLICK = "doubleclick",
TEMPLATE_TH = '<th id="{id}" rowspan="{rowspan}" colspan="{colspan}"><div class="'+CLASS_LINER+'">{value}</div></th>',
TEMPLATE_TR = '<tr id="{id}"></tr>',
TEMPLATE_VALUE = '{value}';
}
/*
* Required NAME static field, to identify the Widget class and
* used as an event prefix, to generate class names etc. (set to the
* class name in camel case).
*/
/*
* The attribute configuration for the widget. This defines the core user facing state of the widget
*/
columnset: {
setter: "_setColumnset"
},
//@type Recordset or Array
recordset: {
setter: "_setRecordset"
},
state: {
readOnly: true
},
strings: {
valueFn: function() {
}
},
},
},
trTemplate: {
}
};
/*
* The HTML_PARSER static constant is used if the Widget supports progressive enhancement, and is
* used to populate the configuration for the DTBase instance from markup already on the page.
*/
DTBase.HTML_PARSER = {
// If progressive enhancement is to be supported, return the value of "attrA" based on the contents of the srcNode
}
};
/* DTBase extends the base Widget class */
// Properties
_theadNode: null,
_tbodyNode: null,
_msgNode: null,
// Attributes
_setColumnset: function(columns) {
},
_setRecordset: function(recordset) {
}
return recordset;
},
// Initialization
initializer: function() {
// Custom events that broadcast DOM updates
// Custom events that broadcast DOM interactions
// Simply pass through DOM event facades
//TODO: do we need queuable=true?
},
// Destruction
destructor: function() {
},
// UI
renderUI: function() {
// TABLE and CAPTION
var ok = this._createTableNode();
// COLGROUP
// THEAD
// Primary TBODY
// Message TBODY
// CAPTION
return ok;
},
_createTableNode: function() {
if (!this._tableNode) {
}
return this._tableNode;
},
_createColgroupNode: function(tableNode) {
// Add COLs to DOCUMENT FRAGMENT
i = 0,
allCols = ["<colgroup>"];
for(; i<len; ++i) {
}
// Create COLGROUP
this._colgroupNode = tableNode.insertBefore(NODE.create(allCols.join("")), tableNode.get("firstChild"));
return this._colgroupNode;
},
_createTheadNode: function(tableNode) {
if(tableNode) {
this._theadNode = tableNode.insertBefore(NODE.create("<thead class='"+CLASS_COLUMNS+"'></thead>"), this._colgroupNode.next());
return this._theadNode;
}
},
_createTbodyNode: function(tableNode) {
return this._tbodyNode;
},
_createMessageNode: function(tableNode) {
this._msgNode = tableNode.insertBefore(NODE.create("<tbody class='"+CLASS_MSG+"'></tbody>"), this._tbodyNode);
return this._msgNode;
},
_createCaptionNode: function(tableNode) {
return this._captionNode;
},
// Events
bindUI: function() {
var tableNode = this._tableNode,
// DOM event delegation for THEAD
// Since we can't listen for click and dblclick on the same element...
// DOM event delegation for TBODY
// Since we can't listen for click and dblclick on the same element...
// DOM event delegation for MSG TBODY
// Since we can't listen for click and dblclick on the same element...
},
_onTheadFocus: function() {
},
_onTheadKeydown: function() {
},
_onTheadMouseover: function() {
},
_onTheadMouseout: function() {
},
_onTheadMouseup: function() {
},
_onTheadMousedown: function() {
},
// e.currentTarget holds the clicked element
_onTheadClick: function(e) {
this.fire("theadCellClick", e);
this.fire("theadRowClick", e);
this.fire("theadClick", e);
},
_onTheadDoubleclick: function() {
},
_onTbodyFocus: function() {
},
_onTbodyKeydown: function() {
},
_onTbodyMouseover: function() {
},
_onTbodyMouseout: function() {
},
_onTbodyMouseup: function() {
},
_onTbodyMousedown: function() {
},
_onTbodyClick: function(e) {
},
_onTbodyDoubleclick: function() {
},
_onMsgFocus: function() {
},
_onMsgKeydown: function() {
},
_onMsgMouseover: function() {
},
_onMsgMouseout: function() {
},
_onMsgMouseup: function() {
},
_onMsgMousedown: function() {
},
_onMsgClick: function(e) {
},
_onMsgDoubleclick: function() {
},
syncUI: function() {
/*
* syncUI is intended to be used by the Widget subclass to
* update the UI to reflect the initial state of the widget,
* after renderUI. From there, the event listeners we bound above
* will take over.
*/
// STRINGS
// THEAD ROWS
// DATA ROWS
},
/* Listeners, UI update methods */
/**
* Updates the UI if changes are made to any of the strings in the strings
* attribute.
*
* @method _afterStringsChange
* @param e {Event} Custom event for the attribute change
* @protected
*/
_afterStringsChange: function (e) {
this._uiSetStrings(e.newVal);
},
_uiSetStrings: function (strings) {
},
_uiSetSummary: function(val) {
},
_uiSetCaption: function(val) {
},
////////////////////////////////////////////////////////////////////////////
//
// THEAD FUNCTIONALITY
//
////////////////////////////////////////////////////////////////////////////
_afterColumnsetChange: function (e) {
this._uiSetColumnset(e.newVal);
},
_uiSetColumnset: function(cs) {
theadNode = this._theadNode,
i = 0,
tr,
}
//TODO: move thead off dom
// Iterate tree to add rows
for(; i<len; ++i) {
if(i === 0) {
}
if(i === len-1) {
}
}
// Column helpers needs _theadNode to exist
//this._createColumnHelpers();
//TODO: move thead on dom
},
_defAddTheadTrFn: function(e) {
i = 0,
th;
for(; i<len; ++i) {
}
},
_getTheadTrMarkup: function(record) {
},
_defAddTheadThFn: function(e) {
//column._set("thNode", thNode);
},
_getTheadThMarkup: function(o, column) {
//TODO o.classnames
//TODO o.abbr = column.get("abbr");
/*TODO
// Clear minWidth on hidden Columns
if(column.get("hidden")) {
//this._clearMinWidth(column);
}
*/
return Y.substitute(this.thTemplate, o);
},
_afterRecordsetChange: function (e) {
this._uiSetRecordset(e.newVal);
},
_uiSetRecordset: function(rs) {
var i = 0,//TODOthis.get("state.offsetIndex"),
// Iterate recordset to use existing or add new tr
for(; i<len; ++i) {
}
},
_defAddTrFn: function(e) {
tbodyNode = this._tbodyNode,
return tr;
},
_createBodyTr: function(record) {
return tr;
},
_getDataTrMarkup: function(record) {
},
var i = 0,
tds = [];
for(; i<len; ++i) {
}
},
var o = {};
return Y.substitute(this.tdTemplate, o);
},
var o = {};
}
});