aggrid vanilla JS NumericCellEditor中的可滚动数字输入字段



我使用的是本文档中的NumericCellEditor。除了一件小事,一切都很好。https://www.ag-grid.com/javascript-data-grid/cell-editors/

我希望在网格中呈现的输入字段具有垂直滚动条,如标准html中所示,如下所示:https://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_number

我尝试了很多方法,但都不起作用。我对代码的调整是:

class NumericCellEditor {
// gets called once before the renderer is used
init(params) {
// create the cell
this.eInput = document.createElement('input');
this.eInput.className = 'simple-input-editor';
this.eInput.type="number";
this.eInput.step=1;
this.eInput.min=1;
this.eInput.max=10;
console.log(this.eInput);
...
}

所有参数都设置并记录在控制台中,但滚动条并不像普通html中那样显示。我也尝试过单元渲染器,但问题仍然存在。有什么想法吗?

init(params) {
this.eInput = document.createElement('input');
this.eInput.type = 'number';
this.eInput.style["height"] = '2.25rem';
this.eInput.style["overflow"] = 'visible';
this.eInput.style["width"] = '100%';

经过一番挣扎,我终于成功了。溢出已经被设置为隐藏。您可以这样做,或者创建一个css类,并使用选项"将其添加到列defs中;cellClass";。

最新更新