Browse Source

Fixed #331: onclick events in items not working.

v3_develop
jos 10 years ago
parent
commit
4a3acd623e
7 changed files with 25307 additions and 25303 deletions
  1. +1
    -0
      HISTORY.md
  2. +25269
    -25268
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +12
    -12
      dist/vis.min.js
  5. +0
    -4
      lib/timeline/component/ItemSet.js
  6. +15
    -10
      lib/timeline/component/item/Item.js
  7. +9
    -8
      test/timeline.html

+ 1
- 0
HISTORY.md View File

@ -21,6 +21,7 @@ http://visjs.org
individual items.
- Fixed height of BackgroundItems not being 100% when timeline has a fixed height.
- Fixed width of BackgroundItems not being reduced to 0 when zooming out.
- Fixed onclick events in items not working.
### DataSet

+ 25269
- 25268
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 12
- 12
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 0
- 4
lib/timeline/component/ItemSet.js View File

@ -1271,8 +1271,6 @@ ItemSet.prototype._onSelectItem = function (event) {
items: this.getSelection()
});
}
event.stopPropagation();
};
/**
@ -1360,8 +1358,6 @@ ItemSet.prototype._onMultiSelectItem = function (event) {
this.body.emitter.emit('select', {
items: this.getSelection()
});
event.stopPropagation();
}
};

+ 15
- 10
lib/timeline/component/item/Item.js View File

@ -171,17 +171,22 @@ Item.prototype._updateContents = function (element) {
content = this.data.content;
}
if (content instanceof Element) {
element.innerHTML = '';
element.appendChild(content);
}
else if (content != undefined) {
element.innerHTML = content;
}
else {
if (!(this.data.type == 'background' && this.data.content === undefined)) {
throw new Error('Property "content" missing in item ' + this.id);
if(content !== this.content) {
// only replace the content when changed
if (content instanceof Element) {
element.innerHTML = '';
element.appendChild(content);
}
else if (content != undefined) {
element.innerHTML = content;
}
else {
if (!(this.data.type == 'background' && this.data.content === undefined)) {
throw new Error('Property "content" missing in item ' + this.id);
}
}
this.content = content;
}
};

+ 9
- 8
test/timeline.html View File

@ -71,7 +71,8 @@
items.add([
{_id: 0, content: 'item 0', start: now.clone().add(3, 'days').toDate(), title: 'hello title!'},
{_id: '1', content: 'item 1<br>start', start: now.clone().add(4, 'days').toDate()},
{_id: 2, content: 'item 2', start: now.clone().add(-2, 'days').toDate() },
{_id: 2, content: '<a href="javascript: alert(\'you clicked an anchor\');">Click here! (anchor)</a><br><br>' +
'<div onclick="alert(\'you clicked a div\'); ">Click here! (div)</div>', start: now.clone().add(-2, 'days').toDate() },
{_id: 3, content: 'item 3', start: now.clone().add(2, 'days').toDate(), style: 'color: red;'},
{
_id: 4, content: 'item 4 ',
@ -111,13 +112,13 @@
});
/*
timeline.on('rangechange', function (range) {
console.log('rangechange', range);
});
timeline.on('rangechanged', function (range) {
console.log('rangechanged', range);
});
*/
timeline.on('rangechange', function (range) {
console.log('rangechange', range);
});
timeline.on('rangechanged', function (range) {
console.log('rangechanged', range);
});
*/
items.on('add', console.log.bind(console));
items.on('update', console.log.bind(console));

Loading…
Cancel
Save