I'm trying to add multiple element to a column in grid editmode without use ng template.
for example, First in view mode column only show value label. when double click a row to change to edit mode this column appent a input element and a button. (please refer below image).
Please support me! Thank you so much
|
<e-column field='ShipCountry' headerText='Ship Country' [edit]='editparams'></e-column> |
|
this.editparams = {
create: () => {
// A parent div element is created and returned for appending the required edit control
this.elem = document.createElement("div");
return this.elem;
},
write: (args) => {
// An input element is created for editing cell value
this.editElement = document.createElement('input');
// Current cell value is appended as the element value
this.editElement.value = args.rowData[args.column.field];
// The edit input is appended as child to the initially created ‘div’ element
this.elem.append(this.editElement);
// A span element is created for displaying an icon
var spanEle = document.createElement('span');
spanEle.classList.add("e-input-group-icon", "e-search-icon", "e-icons");
// The span element is also appended as child to the initially created ‘div’ element
this.elem.appendChild(spanEle);
},
read: () => {
// The edit input element value is returned back for updating in the Grid
return this.editElement.value;
},
destroy: () => {
}
} |
thank you so much.
I have one more question.
How to add event to search icon. I try with click() event but not success.
In this case I want to call function doOpen() with param
|
public ngOnInit(): void {
this.editparams = {
write: (args) => {
...
var spanEle = document.createElement('span');
spanEle.addEventListener('click', this.doOpen.bind(this, args.rowData))
...
}
}
}
doOpen(args) {
console.log("Row data - " + args);
} |