Vue3 defaultContent how to add row data
Vue3 defaultContent how to add row data
Hi I am using Vue3
I want to access the row data to the defaultContent so that I can add the id from my database, Is this possible?
const columns = [
{ data: 'firstname' },
{ data: 'lastname' },
{
data: null,
className: "dt-center editor-edit",
defaultContent: '<i class="fa fa-pencil"/>' <--- here I want to access the row data ,
orderable: false
}
];
Thank you in advance
This discussion has been closed.
Replies
if not possible how can I get the id if I will click the button?
Thank you in advance.
The row data is not accessible using
columns.defaultContent. You can usecolumns.renderto generate the button with info from the row.Or you can use a delegated event, like this example to get the row data of the clicked row. Not sure how this plays into Vue3 though
Kevin
Use
row().data(). See this example.Allan
Thank you fixed now