<td>A template function used to generate the contents of the items. The function is called by the Timeline with an items' data as the first argument and the item element as the second, and must return HTML code, a string or a template as result. When the option template is specified, the items do not need to have a field <code>content</code>. See section <ahref="#Templates">Templates</a> for a detailed explanation.</td>
<td>A template function used to generate the contents of the items. The function is called by the Timeline with an items' data as the first argument, the item element as the second argument and the edited data as the third argument, and must return HTML code, a string or a template as result. When the option template is specified, the items do not need to have a field <code>content</code>. See section <ahref="#Templates">Templates</a> for a detailed explanation.</td>
</tr>
</tr>
<tr>
<tr>
@ -1743,11 +1743,11 @@ var items = new vis.DataSet([
<h2id="Templates">Templates</h2>
<h2id="Templates">Templates</h2>
<p>
<p>
Timeline supports templates to format item contents. Any template engine (such as <ahref="http://handlebarsjs.com/">handlebars</a> or <ahref="http://mustache.github.io/">mustache</a>) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an item's data as argument, and outputs formatted HTML:
Timeline supports templates to format item contents. Any template engine (such as <ahref="http://handlebarsjs.com/">handlebars</a> or <ahref="http://mustache.github.io/">mustache</a>) can be used, and one can also manually build HTML. In the options, one can provide a template handler. This handler is a function accepting an item's data as the first argument, the item element as the second argument and the edited data as the third argument, and outputs formatted HTML:
</p>
</p>
<preclass="prettyprint lang-js">var options = {
<preclass="prettyprint lang-js">var options = {
template: function (item) {
template: function (item, element, data) {
var html = ... // generate HTML markup for this item
var html = ... // generate HTML markup for this item
return html;
return html;
}
}
@ -1759,8 +1759,11 @@ var items = new vis.DataSet([