JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › columns with button › Reply To: columns with button
January 27, 2021 at 9:18 am
#101391
yavordashew
Member
Hi dusrkdldlr,
I have prepared another code snippet for you.
Just change the code in the ‘template’ of the column property you want to change:
{
label: "Due date",
editor: "dateInput",
width: 200,
dataField: "dueDate",
cellsFormat: "d",
allowResize: true,
template: function(formatObject) {
if (!formatObject.template) {
const button = document.createElement("smart-button");
button.innerHTML = 'Click Me';
button.row = formatObject.row;
button.addEventListener("click", () => {
console.log('Button inside the column was clicked')
});
const template = document.createElement("div");
template.appendChild(button);
formatObject.template = template;
}
}
}
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/