我们现有的网格包含在“文本”框下方。我需要将所有这些属性附加到在ag-grid编辑模式( describe('compareToPreviousImage', (): void => {
it('Will return false if it receives identical image strings', (): void => {
expect(compareToPreviousImage(base64ImageString, base64ImageString))
.to.equal(false);
});
});
)中创建的文本框中。我们该如何附加呢?
<input class="ag-cell-edit-input" type="text">
答案 0 :(得分:0)
在使用普通js时,您需要将自定义单元格编辑器创建为函数,然后将所有必需的方法添加到函数原型中。
定义列def:
{ headerName: "Custom Input", field: "customInput", editable: true, cellEditor: 'customTextInputEditor', }
创建您的CustomTextInputEditor
函数:
function CustomTextInputEditor() {
}
然后将所有必需的方法添加到CustomTextInputEditor
原型中,例如init
:
CustomTextInputEditor.prototype.init = function (params) {
this.container = createElementFromHTML('<input typeaheadval="3" onfocus="fnborderRow(21);" onfocusout="fnborderRow(0);" type="text" id="drpClass21" vendorpaymentid="149962" vendorpaymentdetailid="167679" rowid="21" sortfieldcol="clsSortPayee" value="210 UT - Salt Lake City" selectedid="210" onchange="fnChangeObj(this);" style="border-width: 1px; border-style: solid; border-color: rgb(195, 195, 195); background-color: rgb(255, 255, 255);" class="form-control clsSearch clsClass ui-autocomplete-input clsGLClass149962" autocomplete="off">')
$(document).mouseup(function (e) {
var container = $(".clsSearch");
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0) {
params.stopEditing();
}
});
var that = this;
this.container.addEventListener('keydown', function (event) {
//that.onKeyDown(event)
if (event.keyCode == 13) {
//event.stopPropagation();
params.stopEditing();
}
})
};
可以找到here的完整示例。