Browse Source

Merged #996

flowchartTest
jos 9 years ago
parent
commit
58986aa9fa
4 changed files with 19 additions and 3 deletions
  1. +8
    -1
      docs/timeline/index.html
  2. +9
    -1
      lib/timeline/component/Group.js
  3. +1
    -1
      lib/timeline/component/ItemSet.js
  4. +1
    -0
      lib/timeline/optionsTimeline.js

+ 8
- 1
docs/timeline/index.html View File

@ -585,6 +585,13 @@ function (option, path) {
</td> </td>
</tr> </tr>
<tr>
<td>groupTemplate</td>
<td>function</td>
<td>none</td>
<td>A template function used to generate the contents of the groups. The function is called by the Timeline with a groups data as argument, and must return HTML code as result. When the option groupTemplate is specified, the groups do not need to have a field <code>content</code>. See section <a href="#Templates">Templates</a> for a detailed explanation.</td>
</tr>
<tr> <tr>
<td>height</td> <td>height</td>
<td>number or String</td> <td>number or String</td>
@ -1608,4 +1615,4 @@ var options = {
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../js/ie10-viewport-bug-workaround.js"></script> <script src="../js/ie10-viewport-bug-workaround.js"></script>
<!-- controller --> <!-- controller -->
<script src="../js/main.js"></script>
<script src="../js/main.js"></script>

+ 9
- 1
lib/timeline/component/Group.js View File

@ -81,8 +81,16 @@ Group.prototype._create = function() {
*/ */
Group.prototype.setData = function(data) { Group.prototype.setData = function(data) {
// update contents // update contents
var content = data && data.content;
var content;
if (this.itemSet.options && this.itemSet.options.groupTemplate) {
content = this.itemSet.options.groupTemplate(data);
}
else {
content = data && data.content;
}
if (content instanceof Element) { if (content instanceof Element) {
this.dom.inner.appendChild(content);
while (this.dom.inner.firstChild) { while (this.dom.inner.firstChild) {
this.dom.inner.removeChild(this.dom.inner.firstChild); this.dom.inner.removeChild(this.dom.inner.firstChild);
} }

+ 1
- 1
lib/timeline/component/ItemSet.js View File

@ -280,7 +280,7 @@ ItemSet.prototype._create = function(){
ItemSet.prototype.setOptions = function(options) { ItemSet.prototype.setOptions = function(options) {
if (options) { if (options) {
// copy all options that we know // copy all options that we know
var fields = ['type', 'align', 'order', 'stack', 'selectable', 'multiselect', 'groupOrder', 'dataAttributes', 'template','hide', 'snap'];
var fields = ['type', 'align', 'order', 'stack', 'selectable', 'multiselect', 'groupOrder', 'dataAttributes', 'template','groupTemplate','hide', 'snap'];
util.selectiveExtend(fields, this.options, options); util.selectiveExtend(fields, this.options, options);
if ('orientation' in options) { if ('orientation' in options) {

+ 1
- 0
lib/timeline/optionsTimeline.js View File

@ -104,6 +104,7 @@ let allOptions = {
snap: {'function': 'function', 'null': 'null'}, snap: {'function': 'function', 'null': 'null'},
start: {date, number, string, moment}, start: {date, number, string, moment},
template: {'function': 'function'}, template: {'function': 'function'},
groupTemplate: {'function': 'function'},
timeAxis: { timeAxis: {
scale: {string,'undefined': 'undefined'}, scale: {string,'undefined': 'undefined'},
step: {number,'undefined': 'undefined'}, step: {number,'undefined': 'undefined'},

Loading…
Cancel
Save