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

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

@ -5,19 +5,26 @@ 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) {
if(element.value == option) {
element.appendChild(crel('option', {'selected': 'selected'}, option));
} else {
element.appendChild(crel('option', option));
}
}
} else {
for (let option in values) {
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,