Hello, we are evaluating your commercial version.
We are wondering if it is possible to edit tasks that have child objects. We need to be able to edit user configurable lists. Task would be defined such as:
public class Task
{
public int Id { get; set; }
public string Text { get; set; }
...
public virtual List<TaskCat> TaskCats { get; set; }
}
public class TaskCat // task categories
{
public int Id { get; set; }
public string CatKey { get; set; }
public string CatValue { get; set; }
}
And it looks like we could get this to display correctly using a template like :
gantt.form_blocks["cat_editor"] = {
render: function (sns) {
return "<div class='dhx_cal_ltext' style='height:60px;'>C1 "
+ "<input type='text'><br/>C2 <input type='text'></div>";
},
set_value: function (node, value, task) {
node.childNodes[0].value = value[0].Key || "k1";
node.childNodes[1].value = value[0].Value || "v1";
node.childNodes[3].value = value[1].Key || "k2";
node.childNodes[4].value = value[1].Value || "v2";
},
get_value: function (node, task) {
var cats = task.taskCats;
cats[0].Value = node.childNodes[1].value;
cats[1].Value = node.childNodes[4].value;
return cats;
},
focus: function (node) {
var a = node.childNodes[1];
a.select();
a.focus();
}
};
gantt.config.lightbox.sections = [
{ name: "description", height: 70, map_to: "text", type: "textarea" },
{ name: "Cats", height: 50, map_to: "taskCats", type: "cat_editor" },
{ name: "time", height: 72, type: "duration", map_to: "auto" }
];
So getting the data works, but when Save is called the values for child list task.taskCats are all string values like “[object Object],[object Object]”.
In other words, the FormCollection has 1_taskCats coming back as “[object Object]” instead of a usable value or JSON string. And I don’t see anything like 1_taskCats_1_CatValue.
Do you have a suggestion on a way to fix this or a better alternative?