I have a grid. When the focus is put on a cell an input is created with the
value being the cell's text. I would like to size the input to the physical
width of the text. Ideas?
John
function editCell (cell) {
if (document.getEl ementById) {
cell.normalize( );
var input = document.create Element('INPUT' );
input.setAttrib ute('value', cell.firstChild .nodeValue);
input.setAttrib ute('size', cell.firstChild .nodeValue.leng th); //RATHER
THAN SET THE SIZE, I WOULD PREFER TO SET STYLE WIDTH
input.onblur = function (evt) { setCell(this.pa rentNode,this.v alue); };
input.onclick = function (evt) {
evt.cancelBubbl e = true;
if (evt.stopPropag ation)
evt.stopPropaga tion();
};
cell.replaceChi ld(input, cell.firstChild );
input.focus();
input.select();
}
}
value being the cell's text. I would like to size the input to the physical
width of the text. Ideas?
John
function editCell (cell) {
if (document.getEl ementById) {
cell.normalize( );
var input = document.create Element('INPUT' );
input.setAttrib ute('value', cell.firstChild .nodeValue);
input.setAttrib ute('size', cell.firstChild .nodeValue.leng th); //RATHER
THAN SET THE SIZE, I WOULD PREFER TO SET STYLE WIDTH
input.onblur = function (evt) { setCell(this.pa rentNode,this.v alue); };
input.onclick = function (evt) {
evt.cancelBubbl e = true;
if (evt.stopPropag ation)
evt.stopPropaga tion();
};
cell.replaceChi ld(input, cell.firstChild );
input.focus();
input.select();
}
}
Comment