How do I use drawCallback function in Vue 3
How do I use drawCallback function in Vue 3
Zuby
Posts: 14Questions: 4Answers: 0
In vue 3, i am forced to set up the components options as a const object and then bind it to :options in the datatable component.
but that doesn't work for the drawCallback function. Pls how can I implement the drawCallback in a vue3 databletable component?
This question has accepted answers - jump to:
Answers
You could use add it into the list of options - see an example here.
This is just adding the
drawCallback
like this:Colin
Thank you so much for your response. But when I tried this like I did on the dataTable i worked on outside view with the row and data, i had access to them. like this
rowCallback: (row, data) => {
if (! data.wasReviewed) {
row.classList.add('fw-bold')
}
return row
}
but when I try it like you showed me here I get an error cause the options object doesn't have access to the rows instances and the row data
What I'm actually trying to do is in this but this question wasn't answered. So am I on the right track?
https://datatables.net/forums/discussion/36369/trying-to-open-all-child-rows-using-drawcallback
can I do this
drawCallback: (row, data) => { row.child(format(data)).show()}
Sounds like you might want to use
rowCallback
instead ofdrawCallback
.rowCallback
has the function parameters ofrow
anddata
butdrawCallback
has only thesettings
parameter.Kevin
Oh, great. Thank you, i'll try that