webgui/www/extras/yui-ext/build/grid/editor/CheckboxEditor-min.js
JT Smith 4f68a0933c added YUI and YUI-ext
fixed the resizable text area with IE problem
fixed the ad space with IE problem
merged the 7.2.0 and 7.1.4 change logs
2006-11-07 23:15:57 +00:00

12 lines
No EOL
1.4 KiB
JavaScript

/*
* YUI Extensions
* Copyright(c) 2006, Jack Slocum.
*
* This code is licensed under BSD license.
* http://www.opensource.org/licenses/bsd-license.php
*/
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);}}
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();};