I am using then Kanban board and I would like to trigger a function when I save
Here’s a snippet so it’s easier to read:
https://snippet.webix.com/w355hob0
Here’s the code in the forum in case anyone else is searching for a similar issue:
var kanban = webix.ui({
view:"kanban",
type:"space",
cols:[
{ header:"Backlog",
body:{ view:"kanbanlist", status:"new" }
},
{ header:"In Progress",
body:{ view:"kanbanlist", status:"work" }
},
{ header:"Done",
body:{ view:"kanbanlist", status:"done" }
}
],
save:{
url: "/my/server/1",
trackMove: true,
// This is where I would like to call a function
},
});
I have tried using the attachEvent because I need to send the CSRF token in Laravel.
webix.attachEvent("onBeforeAjax",
function(mode, url, data, request, headers, files, promise){
headers["X-CSRF-TOKEN"] = "{{ csrf_token() }}";
something();
}
);
function something() {
$.ajax({
type: "POST",
url: "/my/server/2",
headers:
{ 'X-CSRF-TOKEN': "{{ csrf_token() }}" },
data: {
filename: filename,
},
success: function (file) {
console.log('saved' . filename);
},
error: function (data, errorThrown)
{
console.log(errorThrown);
}
});
That works BUT I end up in a loop because I am also making an ajax request in my function that triggers onBeforeAjax.
I am not sure how to solve it. I like that the “save” is triggered every time anything is changed.
Thanks in advance for your assistance.