Commit 5cb8c254 authored by Sebastien Robin's avatar Sebastien Robin

officejs task app: add parameter to allow grouping in planning

parent 100bde26
......@@ -131,6 +131,7 @@
gadget.property_dict.planning_widget = planning_widget;
return planning_widget.render({
search_page: 'planning',
//grouping_property: 'description',
mapping: {title: 'title',
start: 'start_date',
stop: 'stop_date'},
......
......@@ -119,8 +119,11 @@
link,
container,
item_dict = {},
group_set = new Set(),
timeline,
group_value,
task,
group_data,
items = new vis.DataSet({
//type: { start: 'ISODate', end: 'ISODate' }
});
......@@ -148,7 +151,7 @@
var options = {
//start: '2016-09-10',
//end: '2016-09-30',
height: '500px',
//height: '500px',
// allow selecting multiple items using ctrl+click, shift+click, or hold.
multiselect: true,
......@@ -172,6 +175,11 @@
task = all_docs_result.data.rows[j].value;
item_id = all_docs_result.data.rows[j].id;
item.id = item_id;
if (option_dict.grouping_property !== undefined) {
group_value = task[option_dict.grouping_property];
group_set.add(group_value);
item.group = group_value;
}
item.content = task[option_dict.mapping.title];
item.start = task[option_dict.mapping.start];
item.end = task[option_dict.mapping.stop];
......@@ -184,7 +192,18 @@
translated_column_list.push(gadget.translate(option_dict.column_list[i].title));
}
items.add(item_list);
timeline = new vis.Timeline(container, items, options);
timeline = new vis.Timeline(container);
timeline.setOptions(options);
timeline.setItems(items);
if (group_set.size !== 0) {
group_data = new vis.DataSet();
i = 0;
group_set.forEach(function (group_value) {
group_data.add({id: group_value, content: group_value});
i += 1;
});
timeline.setGroups(group_data);
}
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment