1.Creating task from dataProcessor
var dp = gantt.createDataProcessor(function (entity, action, data, id) {
switch (action) {
case “create”:
return gantt.ajax.post({
url: “/api/” + entity,
headers: {
‘Authorization’: 'Bearer ’ + token,
‘Content-Type’: ‘application/json’
},
data: JSON.stringify(data)
});
break;case “update”:
return gantt.ajax.put({
url: “/api/”+entity+"/" + id,
headers: {
‘Authorization’: 'Bearer ’ + token,
‘Content-Type’: ‘application/json’
},
data: JSON.stringify(data)
});
break;case “delete”:
return gantt.ajax.del({
url: “/api/”+entity+"/"+ id,
headers: {
‘Authorization’: 'Bearer ’ + token,
‘Content-Type’: ‘application/json’
},
data: JSON.stringify(data)
});
// .then(function (response) {
// console.log(response)
// })
break;
}
});
First task created ok, but when without refreshing i tried second new task in first task, it gaves me error
https://gyazo.com/33d017dbc1ef049bd3c93084f1cc2c97
So, i can create second task in first after refresh the page, how it can be solved ?
2.In column Task name, can i do more width, if it needed like on screenshot automaticly, on the screen i have those setup, yes i can be fix if i will add width 200 or somth, but what if user gonna have 10 sublvl or smth
gantt.config.columns = [
{name: “text”, tree: true, width: ‘*’, resize: true},
{name: “start_date”, align: “center”, resize: true},
{name: “duration”, align: “center”},
{name:“priority”, label:“Priority”, template:function(obj){
return gantt.getLabel(“priority”, obj.priority);
}, align: “center”, width:60 },
{
name: “buttons”,
label: colHeader,
width: 75,
template: colContent
}
];
- In buttons add/edit i have custom lightbox, if user will click on new button “share”, can i rewrite lightbox like on screen? ( write multiple
(https://gyazo.com/62fef52ddce61e745b2676736b7b6da0) select , and select, send and cancel)
https://gyazo.com/5e71e0cf55f9c88ad1126b722145a1a8
Can someone plz help with some example, so i can put my html
Using cases
function clickGridButton(id, action) {
switch (action) {
case “share”:
gantt.showLightbox(id);
break;
case “edit”:
gantt.showLightbox(id);
break;
case “add”:
gantt.createTask(null, id);
gantt.refreshData();break;
case “delete”:
gantt.confirm({
title: gantt.locale.labels.confirm_deleting_title,
text: gantt.locale.labels.confirm_deleting,
callback: function (res) {
if (res)
gantt.deleteTask(id);
}
});
break;
}
}