Timeline changes

This commit is contained in:
Hugvey Central Command 2019-05-18 13:14:58 +02:00
parent defab56afa
commit 196801d67c
2 changed files with 15 additions and 7 deletions

15
www/js/crel.min.js vendored
View file

@ -5,18 +5,25 @@ crel.attrMap['on'] = function(element, value) {
element.addEventListener(eventName, value[eventName]);
}
};
crel.attrMap['options'] = function(element, values) {
crel.attrMap['options'] = function(element, values, a, b) {
if(element.tagName != "SELECT") {
return;
}
console.log(values);
if(Array.isArray(values)) {
for (let option of values) {
element.appendChild(crel('option', option));
if(element.value == option) {
element.appendChild(crel('option', {'selected': 'selected'}, option));
} else {
element.appendChild(crel('option', option));
}
}
} else {
for (let option in values) {
element.appendChild(crel('option', {'value': option}, values[option]));
if(element.value == option) {
element.appendChild(crel('option', {'selected': 'selected','value': option}, values[option]));
}else{
element.appendChild(crel('option', {'value': option}, values[option]));
}
}
}

View file

@ -28,6 +28,7 @@ class Timeline{
this.dataGroups = new vis.DataSet(groups);
let options = {
maxHeight: '100%',
height: '100%',
margin : {
item: {
horizontal: 0,