From ef68436ac04da078ffdcacd7e1f785473a303d45 Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Sun, 02 Oct 2011 23:56:18 +0000 Subject: First version of the newly restructured repository --- (limited to 'frontend/beta/js/YUI-extensions/grid/editor') diff --git a/frontend/beta/js/YUI-extensions/grid/editor/CellEditor.js b/frontend/beta/js/YUI-extensions/grid/editor/CellEditor.js new file mode 100644 index 0000000..7c51a48 --- a/dev/null +++ b/frontend/beta/js/YUI-extensions/grid/editor/CellEditor.js @@ -0,0 +1,91 @@ +/** + * @class YAHOO.ext.grid.CellEditor + * Base class for all EditorGrid editors + */ +YAHOO.ext.grid.CellEditor = function(element){ + this.colIndex = null; + this.rowIndex = null; + this.grid = null; + this.editing = false; + this.originalValue = null; + this.element = getEl(element, true); + this.element.addClass('ygrid-editor'); + this.element.dom.tabIndex = 1; + this.initialized = false; + this.callback = null; +}; + +YAHOO.ext.grid.CellEditor.prototype = { + init : function(grid, bodyElement, callback){ + // there's no way for the grid to know if multiple columns + // share the same editor so it will try to initialize the + // same one over and over + if(this.initialized) return; + this.initialized = true; + this.callback = callback; + this.grid = grid; + bodyElement.appendChild(this.element.dom); + this.initEvents(); + }, + + initEvents : function(){ + var stopOnEnter = function(e){ + if(e.browserEvent.keyCode == e.RETURN){ + this.stopEditing(true); + }else if(e.browserEvent.keyCode == e.ESC){ + this.setValue(this.originalValue); + this.stopEditing(true); + } + } + this.element.mon('keydown', stopOnEnter, this, true); + this.element.on('blur', this.stopEditing, this, true); + }, + + startEditing : function(value, row, cell){ + this.originalValue = value; + this.rowIndex = row.rowIndex; + this.colIndex = cell.columnIndex; + this.cell = cell; + this.setValue(value); + var cellbox = getEl(cell, true).getBox(); + this.fitToCell(cellbox); + this.editing = true; + this.show(); + }, + + stopEditing : function(focusCell){ + if(this.editing){ + this.editing = false; + var newValue = this.getValue(); + this.hide(); + //if(focusCell){try{this.cell.focus();}catch(e){}}; // try to give the cell focus so keyboard nav still works + if(this.originalValue != newValue){ + this.callback(newValue, this.rowIndex, this.colIndex); + } + } + }, + + setValue : function(value){ + this.element.dom.value = value; + }, + + getValue : function(){ + return this.element.dom.value; + }, + + fitToCell : function(box){ + this.element.setBox(box, true); + }, + + show : function(){ + this.element.show(); + this.element.focus(); + }, + + hide : function(){ + try{ + this.element.dom.blur(); + }catch(e){} + this.element.hide(); + } +}; diff --git a/frontend/beta/js/YUI-extensions/grid/editor/CheckboxEditor.js b/frontend/beta/js/YUI-extensions/grid/editor/CheckboxEditor.js new file mode 100644 index 0000000..681b847 --- a/dev/null +++ b/frontend/beta/js/YUI-extensions/grid/editor/CheckboxEditor.js @@ -0,0 +1,60 @@ +/** + * @class YAHOO.ext.grid.CheckboxEditor + * @extends YAHOO.ext.grid.CellEditor +Provides a checkbox for editing boolean values. It currently has no configuration options.

+For more information on using this editor, see this blog post. +* @constructor +* Create a new CheckboxEditor + */ +YAHOO.ext.grid.CheckboxEditor = function(){ + var div = document.createElement('span'); + div.className = 'ygrid-editor ygrid-checkbox-editor'; + var cb = document.createElement('input'); + cb.type = 'checkbox'; + cb.setAttribute('autocomplete', 'off'); + div.appendChild(cb); + document.body.appendChild(div); + YAHOO.ext.grid.CheckboxEditor.superclass.constructor.call(this, div); + div.tabIndex = ''; + cb.tabIndex = 1; + this.cb = getEl(cb, true); +}; + +YAHOO.extendX(YAHOO.ext.grid.CheckboxEditor, YAHOO.ext.grid.CellEditor); + +YAHOO.ext.grid.CheckboxEditor.prototype.fitToCell = function(box){ + this.element.setBox(box, true); +}; + +YAHOO.ext.grid.CheckboxEditor.prototype.setValue = function(value){ + this.cb.dom.checked = (value === true || value === 'true' || value === 1 || value === '1'); +}; + +YAHOO.ext.grid.CheckboxEditor.prototype.getValue = function(){ + return this.cb.dom.checked; +}; + +YAHOO.ext.grid.CheckboxEditor.prototype.show = function(){ + this.element.show(); + this.cb.focus(); +}; + +YAHOO.ext.grid.CheckboxEditor.prototype.initEvents = function(){ + var stopOnEnter = function(e){ + if(e.browserEvent.keyCode == e.RETURN){ + this.stopEditing(true); + }else if(e.browserEvent.keyCode == e.ESC){ + this.setValue(this.originalValue); + this.stopEditing(true); + } + } + this.cb.mon('keydown', stopOnEnter, this, true); + this.cb.on('blur', this.stopEditing, this, true); +}; + +YAHOO.ext.grid.CheckboxEditor.prototype.hide = function(){ + try{ + this.cb.dom.blur(); + }catch(e){} + this.element.hide(); +}; diff --git a/frontend/beta/js/YUI-extensions/grid/editor/DateEditor.js b/frontend/beta/js/YUI-extensions/grid/editor/DateEditor.js new file mode 100644 index 0000000..303ad2b --- a/dev/null +++ b/frontend/beta/js/YUI-extensions/grid/editor/DateEditor.js @@ -0,0 +1,268 @@ +/** + * @class YAHOO.ext.grid.DateEditor + * @extends YAHOO.ext.grid.CellEditor +Provides a date editor field, and optionally a DatePicker. The DateEditor provides a method to override (showCalendar) if you don't want to use the built in DatePicker control. The reason I chose to use my own DatePicker control rather than the nice YUI Calendar component is my control was very easy to override events to make it work well with the grid. It's also only 5k compressed, while the YUI Calendar is 40k compressed. The DatePicker supports left/right keys to move months, up/down keys to move years and the mouse wheel to quickly go through the months. The DateEditor supports the following configuration options: + +For more information on using this editor, see this blog post. +* @constructor +* Create a new DateEditor +* @param {Object} config + */ +YAHOO.ext.grid.DateEditor = function(config){ + var div = document.createElement('span'); + div.className = 'ygrid-editor ygrid-editor-container'; + + var element = document.createElement('input'); + element.type = 'text'; + element.tabIndex = 1; + element.setAttribute('autocomplete', 'off'); + div.appendChild(element); + + var pick = document.createElement('span'); + pick.className = 'pick-button'; + div.appendChild(pick); + + document.body.appendChild(div); + + this.div = getEl(div, true); + this.element = getEl(element, true); + this.pick = getEl(pick, true); + + this.colIndex = null; + this.rowIndex = null; + this.grid = null; + this.editing = false; + this.originalValue = null; + this.initialized = false; + this.callback = null; + + this.cal = null; + this.mouseDownHandler = YAHOO.ext.EventManager.wrap(this.handleMouseDown, this, true); + + YAHOO.ext.util.Config.apply(this, config); + if(typeof this.minValue == 'string') this.minValue = this.parseDate(this.minValue); + if(typeof this.maxValue == 'string') this.maxValue = this.parseDate(this.maxValue); + this.ddMatch = /ddnone/; + if(this.disabledDates){ + var dd = this.disabledDates; + var re = "(?:"; + for(var i = 0; i < dd.length; i++){ + re += dd[i]; + if(i != dd.length-1) re += "|"; + } + this.ddMatch = new RegExp(re + ")"); + } +}; + +YAHOO.ext.grid.DateEditor.prototype = { + init : function(grid, bodyElement, callback){ + if(this.initialized) return; + + this.initialized = true; + this.callback = callback; + this.grid = grid; + bodyElement.appendChild(this.div.dom); + this.initEvents(); + }, + + initEvents : function(){ + var stopOnEnter = function(e){ + if(e.browserEvent.keyCode == e.RETURN){ + this.stopEditing(true); + }else if(e.browserEvent.keyCode == e.ESC){ + this.setValue(this.originalValue); + this.stopEditing(true); + } + } + this.element.mon('keydown', stopOnEnter, this, true); + var vtask = new YAHOO.ext.util.DelayedTask(this.validate, this); + this.element.mon('keyup', vtask.delay.createDelegate(vtask, [this.validationDelay])); + this.pick.on('click', this.showCalendar, this, true); + }, + + startEditing : function(value, row, cell){ + this.originalValue = value; + this.rowIndex = row.rowIndex; + this.colIndex = cell.columnIndex; + this.cell = cell; + this.setValue(value); + this.validate(); + var cellbox = getEl(cell, true).getBox(); + this.div.setBox(cellbox, true); + this.element.setWidth(cellbox.width-this.pick.getWidth()); + this.editing = true; + YAHOO.util.Event.on(document, "mousedown", this.mouseDownHandler); + this.show(); + }, + + stopEditing : function(focusCell){ + if(this.editing){ + YAHOO.util.Event.removeListener(document, "mousedown", this.mouseDownHandler); + this.editing = false; + var newValue = this.getValue(); + this.hide(); + //if(focusCell){try{this.cell.focus();}catch(e){}}// try to give the cell focus so keyboard nav still works + if(this.originalValue != newValue){ + this.callback(newValue, this.rowIndex, this.colIndex); + } + } + }, + + setValue : function(value){ + this.element.dom.value = this.formatDate(value); + this.validate(); + }, + + getValue : function(){ + if(!this.validate()){ + return this.originalValue; + }else{ + var value = this.element.dom.value; + if(value.length < 1){ + return value; + } else{ + return this.parseDate(value); + } + } + }, + + show : function() { + this.div.show(); + this.element.focus(); + this.validate(); + }, + + hide : function(){ + try{ + this.element.dom.blur(); + }catch(e){} + this.div.hide(); + }, + + validate : function(){ + var dom = this.element.dom; + var value = dom.value; + if(value.length < 1){ // if it's blank + if(this.allowBlank){ + dom.title = ''; + this.element.removeClass('ygrid-editor-invalid'); + return true; + }else{ + dom.title = this.blankText; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + } + value = this.parseDate(value); + if(!value){ + dom.title = this.invalidText.replace('%0', dom.value).replace('%1', this.format); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + var time = value.getTime(); + if(this.minValue && time < this.minValue.getTime()){ + dom.title = this.minText.replace('%0', this.formatDate(this.minValue)); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + if(this.maxValue && time > this.maxValue.getTime()){ + dom.title = this.maxText.replace('%0', this.formatDate(this.maxValue)); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + if(this.disabledDays){ + var day = value.getDay(); + for(var i = 0; i < this.disabledDays.length; i++) { + if(day === this.disabledDays[i]){ + dom.title = this.disabledDaysText; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + } + } + var fvalue = this.formatDate(value); + if(this.ddMatch.test(fvalue)){ + dom.title = this.disabledDatesText.replace('%0', fvalue); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + var msg = this.validator(value); + if(msg !== true){ + dom.title = msg; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + dom.title = ''; + this.element.removeClass('ygrid-editor-invalid'); + return true; + }, + + handleMouseDown : function(e){ + var t = e.getTarget(); + var dom = this.div.dom; + if(t != dom && !YAHOO.util.Dom.isAncestor(dom, t)){ + this.stopEditing(); + } + }, + + showCalendar : function(value){ + if(this.cal == null){ + this.cal = new YAHOO.ext.DatePicker(this.div.dom.parentNode.parentNode); + } + this.cal.minDate = this.minValue; + this.cal.maxDate = this.maxValue; + this.cal.disabledDatesRE = this.ddMatch; + this.cal.disabledDatesText = this.disabledDatesText; + this.cal.disabledDays = this.disabledDays; + this.cal.disabledDaysText = this.disabledDaysText; + this.cal.format = this.format; + if(this.minValue){ + this.cal.minText = this.minText.replace('%0', this.formatDate(this.minValue)); + } + if(this.maxValue){ + this.cal.maxText = this.maxText.replace('%0', this.formatDate(this.maxValue)); + } + var r = this.div.getRegion(); + this.cal.show(r.left, r.bottom, this.getValue(), this.setValue.createDelegate(this)); + }, + + parseDate : function(value){ + if(!value || value instanceof Date) return value; + return Date.parseDate(value, this.format); + }, + + formatDate : function(date){ + if(!date || !(date instanceof Date)) return date; + return date.format(this.format); + } +}; + +YAHOO.ext.grid.DateEditor.prototype.format = 'm/d/y'; +YAHOO.ext.grid.DateEditor.prototype.disabledDays = null; +YAHOO.ext.grid.DateEditor.prototype.disabledDaysText = ''; +YAHOO.ext.grid.DateEditor.prototype.disabledDates = null; +YAHOO.ext.grid.DateEditor.prototype.disabledDatesText = ''; +YAHOO.ext.grid.DateEditor.prototype.allowBlank = true; +YAHOO.ext.grid.DateEditor.prototype.minValue = null; +YAHOO.ext.grid.DateEditor.prototype.maxValue = null; +YAHOO.ext.grid.DateEditor.prototype.minText = 'The date in this field must be after %0'; +YAHOO.ext.grid.DateEditor.prototype.maxText = 'The date in this field must be before %0'; +YAHOO.ext.grid.DateEditor.prototype.blankText = 'This field cannot be blank'; +YAHOO.ext.grid.DateEditor.prototype.invalidText = '%0 is not a valid date - it must be in the format %1'; +YAHOO.ext.grid.DateEditor.prototype.validationDelay = 200; +YAHOO.ext.grid.DateEditor.prototype.validator = function(){return true;}; diff --git a/frontend/beta/js/YUI-extensions/grid/editor/NumberEditor.js b/frontend/beta/js/YUI-extensions/grid/editor/NumberEditor.js new file mode 100644 index 0000000..f74d3d9 --- a/dev/null +++ b/frontend/beta/js/YUI-extensions/grid/editor/NumberEditor.js @@ -0,0 +1,166 @@ +/** + * @class YAHOO.ext.grid.NumberEditor + * @extends YAHOO.ext.grid.CellEditor +Provides a masked editor for numeric values. Invalid keys are ignored. It supports the following configuration options: + +For more information on using this editor, see this blog post. +* @constructor +* Create a new NumberEditor +* @param {Object} config + */ +YAHOO.ext.grid.NumberEditor = function(config){ + var element = document.createElement('input'); + element.type = 'text'; + element.className = 'ygrid-editor ygrid-num-editor'; + element.setAttribute('autocomplete', 'off'); + document.body.appendChild(element); + YAHOO.ext.grid.NumberEditor.superclass.constructor.call(this, element); + YAHOO.ext.util.Config.apply(this, config); +}; +YAHOO.extendX(YAHOO.ext.grid.NumberEditor, YAHOO.ext.grid.CellEditor); + +YAHOO.ext.grid.NumberEditor.prototype.initEvents = function(){ + var stopOnEnter = function(e){ + if(e.browserEvent.keyCode == e.RETURN){ + this.stopEditing(true); + }else if(e.browserEvent.keyCode == e.ESC){ + this.setValue(this.originalValue); + this.stopEditing(true); + } + }; + + var allowed = "0123456789"; + if(this.allowDecimals){ + allowed += this.decimalSeparator; + } + if(this.allowNegative){ + allowed += '-'; + } + var keyPress = function(e){ + var c = e.getCharCode(); + if(c != e.BACKSPACE && allowed.indexOf(String.fromCharCode(c)) === -1){ + e.stopEvent(); + } + }; + this.element.mon('keydown', stopOnEnter, this, true); + var vtask = new YAHOO.ext.util.DelayedTask(this.validate, this); + this.element.mon('keyup', vtask.delay.createDelegate(vtask, [this.validationDelay])); + this.element.mon('keypress', keyPress, this, true); + this.element.on('blur', this.stopEditing, this, true); +}; + +YAHOO.ext.grid.NumberEditor.prototype.validate = function(){ + var dom = this.element.dom; + var value = dom.value; + if(value.length < 1){ // if it's blank + if(this.allowBlank){ + dom.title = ''; + this.element.removeClass('ygrid-editor-invalid'); + return true; + }else{ + dom.title = this.blankText; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + } + if(value.search(/\d+/) === -1){ + dom.title = this.nanText.replace('%0', value); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + var num = this.parseValue(value); + if(num < this.minValue){ + dom.title = this.minText.replace('%0', this.minValue); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + if(num > this.maxValue){ + dom.title = this.maxText.replace('%0', this.maxValue); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + var msg = this.validator(value); + if(msg !== true){ + dom.title = msg; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + dom.title = ''; + this.element.removeClass('ygrid-editor-invalid'); + return true; +}; + +YAHOO.ext.grid.NumberEditor.prototype.show = function(){ + this.element.dom.title = ''; + YAHOO.ext.grid.NumberEditor.superclass.show.call(this); + if(this.selectOnFocus){ + try{ + this.element.dom.select(); + }catch(e){} + } + this.validate(this.element.dom.value); +}; + +YAHOO.ext.grid.NumberEditor.prototype.getValue = function(){ + if(!this.validate()){ + return this.originalValue; + }else{ + var value = this.element.dom.value; + if(value.length < 1){ + return value; + } else{ + return this.fixPrecision(this.parseValue(value)); + } + } +}; +YAHOO.ext.grid.NumberEditor.prototype.parseValue = function(value){ + return parseFloat(new String(value).replace(this.decimalSeparator, '.')); +}; + +YAHOO.ext.grid.NumberEditor.prototype.fixPrecision = function(value){ + if(!this.allowDecimals || this.decimalPrecision == -1 || isNaN(value) || value == 0 || !value){ + return value; + } + // this should work but doesn't due to precision error in JS + // var scale = Math.pow(10, this.decimalPrecision); + // var fixed = this.decimalPrecisionFcn(value * scale); + // return fixed / scale; + // + // so here's our workaround: + var scale = Math.pow(10, this.decimalPrecision+1); + var fixed = this.decimalPrecisionFcn(value * scale); + fixed = this.decimalPrecisionFcn(fixed/10); + return fixed / (scale/10); +}; + +YAHOO.ext.grid.NumberEditor.prototype.allowBlank = true; +YAHOO.ext.grid.NumberEditor.prototype.allowDecimals = true; +YAHOO.ext.grid.NumberEditor.prototype.decimalSeparator = '.'; +YAHOO.ext.grid.NumberEditor.prototype.decimalPrecision = 2; +YAHOO.ext.grid.NumberEditor.prototype.decimalPrecisionFcn = Math.floor; +YAHOO.ext.grid.NumberEditor.prototype.allowNegative = true; +YAHOO.ext.grid.NumberEditor.prototype.selectOnFocus = true; +YAHOO.ext.grid.NumberEditor.prototype.minValue = Number.NEGATIVE_INFINITY; +YAHOO.ext.grid.NumberEditor.prototype.maxValue = Number.MAX_VALUE; +YAHOO.ext.grid.NumberEditor.prototype.minText = 'The minimum value for this field is %0'; +YAHOO.ext.grid.NumberEditor.prototype.maxText = 'The maximum value for this field is %0'; +YAHOO.ext.grid.NumberEditor.prototype.blankText = 'This field cannot be blank'; +YAHOO.ext.grid.NumberEditor.prototype.nanText = '%0 is not a valid number'; +YAHOO.ext.grid.NumberEditor.prototype.validationDelay = 100; +YAHOO.ext.grid.NumberEditor.prototype.validator = function(){return true;}; diff --git a/frontend/beta/js/YUI-extensions/grid/editor/SelectEditor.js b/frontend/beta/js/YUI-extensions/grid/editor/SelectEditor.js new file mode 100644 index 0000000..200b8e3 --- a/dev/null +++ b/frontend/beta/js/YUI-extensions/grid/editor/SelectEditor.js @@ -0,0 +1,37 @@ +/** + * @class YAHOO.ext.grid.SelectEditor + * @extends YAHOO.ext.grid.CellEditor +Creates an editor out of an existing select field. You can create the select element through DOM in Javascript and pass it to the SelectEditor's constructor or an easier way is like this: +

+Define the select field in your document, giving it the ygrid-editor class. +

+<select id="light" class="ygrid-editor">
+	<option value="Shade">Shade</option>
+	<option value="Mostly Shady">Mostly Shady</option>
+	<option value="Sun or Shade">Sun or Shade</option>
+	<option value="Mostly Sunny">Mostly Sunny</option>
+	<option value="Sunny">Sunny</option>
+</select>
+
+Create the SelectEditor object, passing in the id of your select field. +

+var editor = new YAHOO.ext.grid.SelectEditor('light'); 
+
+For more information on using this editor, see this blog post. +* @constructor +* Create a new SelectEditor +* @param {HTMLElement/String} element + */ +YAHOO.ext.grid.SelectEditor = function(element){ + element.hideFocus = true; + YAHOO.ext.grid.SelectEditor.superclass.constructor.call(this, element); + this.element.swallowEvent('click'); +}; +YAHOO.extendX(YAHOO.ext.grid.SelectEditor, YAHOO.ext.grid.CellEditor); + +YAHOO.ext.grid.SelectEditor.prototype.fitToCell = function(box){ + if(YAHOO.ext.util.Browser.isGecko){ + box.height -= 3; + } + this.element.setBox(box, true); +}; diff --git a/frontend/beta/js/YUI-extensions/grid/editor/TextEditor.js b/frontend/beta/js/YUI-extensions/grid/editor/TextEditor.js new file mode 100644 index 0000000..3c97acd --- a/dev/null +++ b/frontend/beta/js/YUI-extensions/grid/editor/TextEditor.js @@ -0,0 +1,110 @@ +/** + * @class YAHOO.ext.grid.TextEditor + * @extends YAHOO.ext.grid.CellEditor +Provides basic text editing for a cells and supports the following configuration options: + +For more information on using this editor, see this blog post. +* @constructor +* Create a new TextEditor +* @param {Object} config + */ +YAHOO.ext.grid.TextEditor = function(config){ + var element = document.createElement('input'); + element.type = 'text'; + element.className = 'ygrid-editor ygrid-text-editor'; + element.setAttribute('autocomplete', 'off'); + document.body.appendChild(element); + YAHOO.ext.grid.TextEditor.superclass.constructor.call(this, element); + YAHOO.ext.util.Config.apply(this, config); +}; +YAHOO.extendX(YAHOO.ext.grid.TextEditor, YAHOO.ext.grid.CellEditor); + +YAHOO.ext.grid.TextEditor.prototype.validate = function(){ + var dom = this.element.dom; + var value = dom.value; + if(value.length < 1){ // if it's blank + if(this.allowBlank){ + dom.title = ''; + this.element.removeClass('ygrid-editor-invalid'); + return true; + }else{ + dom.title = this.blankText; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + } + if(value.length < this.minLength){ + dom.title = this.minText.replace('%0', this.minLength); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + if(value.length > this.maxLength){ + dom.title = this.maxText.replace('%0', this.maxLength); + this.element.addClass('ygrid-editor-invalid'); + return false; + } + var msg = this.validator(value); + if(msg !== true){ + dom.title = msg; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + if(this.regex && !this.regex.test(value)){ + dom.title = this.regexText; + this.element.addClass('ygrid-editor-invalid'); + return false; + } + dom.title = ''; + this.element.removeClass('ygrid-editor-invalid'); + return true; +}; + +YAHOO.ext.grid.TextEditor.prototype.initEvents = function(){ + YAHOO.ext.grid.TextEditor.superclass.initEvents.call(this); + var vtask = new YAHOO.ext.util.DelayedTask(this.validate, this); + this.element.mon('keyup', vtask.delay.createDelegate(vtask, [this.validationDelay])); +}; + +YAHOO.ext.grid.TextEditor.prototype.show = function(){ + this.element.dom.title = ''; + YAHOO.ext.grid.TextEditor.superclass.show.call(this); + this.element.focus(); + if(this.selectOnFocus){ + try{ + this.element.dom.select(); + }catch(e){} + } + this.validate(this.element.dom.value); +}; + +YAHOO.ext.grid.TextEditor.prototype.getValue = function(){ + if(!this.validate()){ + return this.originalValue; + }else{ + return this.element.dom.value; + } +}; + +YAHOO.ext.grid.TextEditor.prototype.allowBlank = true; +YAHOO.ext.grid.TextEditor.prototype.minLength = 0; +YAHOO.ext.grid.TextEditor.prototype.maxLength = Number.MAX_VALUE; +YAHOO.ext.grid.TextEditor.prototype.minText = 'The minimum length for this field is %0'; +YAHOO.ext.grid.TextEditor.prototype.maxText = 'The maximum length for this field is %0'; +YAHOO.ext.grid.TextEditor.prototype.selectOnFocus = true; +YAHOO.ext.grid.TextEditor.prototype.blankText = 'This field cannot be blank'; +YAHOO.ext.grid.TextEditor.prototype.validator = function(){return true;}; +YAHOO.ext.grid.TextEditor.prototype.validationDelay = 200; +YAHOO.ext.grid.TextEditor.prototype.regex = null; +YAHOO.ext.grid.TextEditor.prototype.regexText = ''; -- cgit v0.9.0.2