Hopkins-Plugin-HMI
view release on metacpan or search on metacpan
share/root/static/yui/build/datatable/datatable.js view on Meta::CPAN
};
lang.extend(DT, util.Element, {
/////////////////////////////////////////////////////////////////////////////
//
// Superclass methods
//
/////////////////////////////////////////////////////////////////////////////
/**
* Implementation of Element's abstract method. Sets up config values.
*
* @method initAttributes
* @param oConfigs {Object} (Optional) Object literal definition of configuration values.
* @private
*/
initAttributes : function(oConfigs) {
oConfigs = oConfigs || {};
DT.superclass.initAttributes.call(this, oConfigs);
/**
* @attribute summary
* @description Value for the SUMMARY attribute.
* @type String
* @default ""
*/
this.setAttributeConfig("summary", {
value: "",
validator: lang.isString,
method: function(sSummary) {
if(this._elTable) {
this._elTable.summary = sSummary;
}
}
});
/**
* @attribute selectionMode
* @description Specifies row or cell selection mode. Accepts the following strings:
* <dl>
* <dt>"standard"</dt>
* <dd>Standard row selection with support for modifier keys to enable
* multiple selections.</dd>
*
* <dt>"single"</dt>
* <dd>Row selection with modifier keys disabled to not allow
* multiple selections.</dd>
*
* <dt>"singlecell"</dt>
* <dd>Cell selection with modifier keys disabled to not allow
* multiple selections.</dd>
*
* <dt>"cellblock"</dt>
* <dd>Cell selection with support for modifier keys to enable multiple
* selections in a block-fashion, like a spreadsheet.</dd>
*
* <dt>"cellrange"</dt>
* <dd>Cell selection with support for modifier keys to enable multiple
* selections in a range-fashion, like a calendar.</dd>
* </dl>
*
* @default "standard"
* @type String
*/
this.setAttributeConfig("selectionMode", {
value: "standard",
validator: lang.isString
});
/**
* @attribute sortedBy
* @description Object literal provides metadata for initial sort values if
* data will arrive pre-sorted:
* <dl>
* <dt>sortedBy.key</dt>
* <dd>{String} Key of sorted Column</dd>
* <dt>sortedBy.dir</dt>
* <dd>{String} Initial sort direction, either YAHOO.widget.DataTable.CLASS_ASC or YAHOO.widget.DataTable.CLASS_DESC</dd>
* </dl>
* @type Object | null
*/
this.setAttributeConfig("sortedBy", {
value: null,
// TODO: accepted array for nested sorts
validator: function(oNewSortedBy) {
if(oNewSortedBy) {
return (lang.isObject(oNewSortedBy) && oNewSortedBy.key);
}
else {
return (oNewSortedBy === null);
}
},
method: function(oNewSortedBy) {
// Stash the previous value
var oOldSortedBy = this.get("sortedBy");
// Workaround for bug 1827195
this._configs.sortedBy.value = oNewSortedBy;
// Remove ASC/DESC from TH
var oOldColumn,
nOldColumnKeyIndex,
oNewColumn,
nNewColumnKeyIndex;
if(this._elThead) {
if(oOldSortedBy && oOldSortedBy.key && oOldSortedBy.dir) {
oOldColumn = this._oColumnSet.getColumn(oOldSortedBy.key);
nOldColumnKeyIndex = oOldColumn.getKeyIndex();
// Remove previous UI from THEAD
var elOldTh = oOldColumn.getThEl();
Dom.removeClass(elOldTh, oOldSortedBy.dir);
this.formatTheadCell(oOldColumn.getThLinerEl().firstChild, oOldColumn, oNewSortedBy);
}
if(oNewSortedBy) {
oNewColumn = (oNewSortedBy.column) ? oNewSortedBy.column : this._oColumnSet.getColumn(oNewSortedBy.key);
nNewColumnKeyIndex = oNewColumn.getKeyIndex();
share/root/static/yui/build/datatable/datatable.js view on Meta::CPAN
this.checkboxes[0].focus();
},
/**
* Retrieves input value from CheckboxCellEditor.
*
* @method getInputValue
*/
getInputValue : function() {
var checkedValues = [];
for(var i=0, j=this.checkboxes.length; i<j; i++) {
if(this.checkboxes[i].checked) {
checkedValues[checkedValues.length] = this.checkboxes[i].value;
}
}
return checkedValues;
}
});
// Copy static members to CheckboxCellEditor class
lang.augmentObject(widget.CheckboxCellEditor, BCE);
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/**
* The DataCellEditor class provides functionality for inline editing
* DataTable cell data with a YUI Calendar.
*
* @namespace YAHOO.widget
* @class DateCellEditor
* @extends YAHOO.widget.BaseCellEditor
* @constructor
* @param oConfigs {Object} (Optional) Object literal of configs.
*/
widget.DateCellEditor = function(oConfigs) {
this._sId = "yui-dateceditor" + YAHOO.widget.BaseCellEditor._nCount++;
widget.DateCellEditor.superclass.constructor.call(this, "date", oConfigs);
};
// CheckboxCellEditor extends BaseCellEditor
lang.extend(widget.DateCellEditor, BCE, {
/////////////////////////////////////////////////////////////////////////////
//
// DateCellEditor public properties
//
/////////////////////////////////////////////////////////////////////////////
/**
* Reference to Calendar instance.
*
* @property calendar
* @type YAHOO.widget.Calendar
*/
calendar : null,
/**
* Configs for the calendar instance, to be passed to Calendar constructor.
*
* @property calendarOptions
* @type Object
*/
calendarOptions : null,
/**
* Default value.
*
* @property defaultValue
* @type Date
* @default new Date()
*/
defaultValue : new Date(),
/////////////////////////////////////////////////////////////////////////////
//
// DateCellEditor public methods
//
/////////////////////////////////////////////////////////////////////////////
/**
* Render a Calendar.
*
* @method renderForm
*/
renderForm : function() {
// Calendar widget
if(YAHOO.widget.Calendar) {
var calContainer = this.getContainerEl().appendChild(document.createElement("div"));
calContainer.id = this.getId() + "-dateContainer"; // Needed for Calendar constructor
var calendar =
new YAHOO.widget.Calendar(this.getId() + "-date",
calContainer.id, this.calendarOptions);
calendar.render();
calContainer.style.cssFloat = "none";
if(ua.ie) {
var calFloatClearer = this.getContainerEl().appendChild(document.createElement("div"));
calFloatClearer.style.clear = "both";
}
this.calendar = calendar;
if(this.disableBtns) {
this.handleDisabledBtns();
}
}
else {
}
},
/**
* After rendering form, if disabledBtns is set to true, then sets up a mechanism
* to save input without them.
*
* @method handleDisabledBtns
*/
handleDisabledBtns : function() {
this.calendar.selectEvent.subscribe(function(v){
// Save on select
this.save();
}, this, true);
},
/**
* Resets DateCellEditor UI to initial state.
*
* @method resetForm
*/
resetForm : function() {
var value = this.value;
var selectedValue = (value.getMonth()+1)+"/"+value.getDate()+"/"+value.getFullYear();
this.calendar.cfg.setProperty("selected",selectedValue,false);
this.calendar.render();
},
/**
* Sets focus in DateCellEditor.
*
* @method focus
*/
focus : function() {
// To be impmlemented by subclass
},
/**
* Retrieves input value from DateCellEditor.
*
* @method getInputValue
*/
getInputValue : function() {
return this.calendar.getSelectedDates()[0];
}
});
// Copy static members to DateCellEditor class
lang.augmentObject(widget.DateCellEditor, BCE);
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/**
* The DropdownCellEditor class provides functionality for inline editing
* DataTable cell data a SELECT element.
*
* @namespace YAHOO.widget
* @class DropdownCellEditor
* @extends YAHOO.widget.BaseCellEditor
* @constructor
* @param oConfigs {Object} (Optional) Object literal of configs.
*/
widget.DropdownCellEditor = function(oConfigs) {
this._sId = "yui-dropdownceditor" + YAHOO.widget.BaseCellEditor._nCount++;
widget.DropdownCellEditor.superclass.constructor.call(this, "dropdown", oConfigs);
};
// DropdownCellEditor extends BaseCellEditor
lang.extend(widget.DropdownCellEditor, BCE, {
/////////////////////////////////////////////////////////////////////////////
//
// DropdownCellEditor public properties
//
/////////////////////////////////////////////////////////////////////////////
/**
* Array of dropdown values. Can either be a simple array (e.g.,
* ["Alabama","Alaska","Arizona","Arkansas"]) or a an array of objects (e.g.,
* [{label:"Alabama", value:"AL"}, {label:"Alaska", value:"AK"},
* {label:"Arizona", value:"AZ"}, {label:"Arkansas", value:"AR"}]).
*
* @property dropdownOptions
* @type String[] | Object[]
*/
dropdownOptions : null,
/**
* Reference to Dropdown element.
*
* @property dropdown
* @type HTMLElement
*/
dropdown : null,
( run in 0.562 second using v1.01-cache-2.11-cpan-437f7b0c052 )