my problem is that when integrating datatables.net to my VUE component, I get the following: (image below), but at the time of using the search remains blank
After much I found a possible answer,
just add Update
updated: function () {
this.$nextTick(function () {
$('#usuarios1').DataTable({
'destroy' :true,
'stateSave' : true,
}).draw();
})
}
this goes before the methods, and axios queries have to be in "let"
let data1 =axios.get("api/user").then((response)=>{ this.roles = response.data.roles});
so you can send the information to DataTables
Try that instead of filling the table in template
, do it for JS.
var data = [
[
"Yamile Ibarra xxxxxx",
"[email protected]",
"xxxxxxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxxxxxx",
],
[
"Jorge xxxxxxx",
"[email protected]",
"xxxxxxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxxxxxx",
],
...
];
$('#usuarios1').DataTable( {
data: data,
...
} );
Source: link
Greetings!