I'm trying to load a graph timeline made by using vis.js, but i'm getting the error:
Traceback: Error: No container provided at o.n._create (http://localhost:8069/web/content/500-8270a43/web.assets_backend.js:3316:153882) at new o (http://localhost:8069/web/content/500-8270a43/web.assets_backend.js:3316:99553) at http://localhost:8069/web/content/500-8270a43/web.assets_backend.js:3319:846
My js code:
odoo.define('test_timeline.timeline', function (require){
"use strict";
var core = require('web.core');
var rpc = require('web.rpc');
var AbstractAction = require('web.AbstractAction');
var QWeb = core.qweb;
var TimelineDashboard = AbstractAction.extend({
start: function(){
var self = this;
rpc.query({
model: 'project.project',
method: 'get_project_record', //call python function
args: [],}).then((res) => {
var container = document.getElementById('visualization');
//will use res on Dataset
var items = new vis.DataSet([
{id: 1, content: 'item 1', start: '2013-04-20'},
{id: 2, content: 'item 2', start: '2013-04-14'},
{id: 3, content: 'item 3', start: '2013-04-18'},
{id: 4, content: 'item 4', start: '2013-04-16', end: '2013-05-19'},
{id: 5, content: 'item 5', start: '2013-04-25'},
{id: 6, content: 'item 6', start: '2013-06-27'},
{id: 7, content: 'item 7', start: '2013-05-27'},
{id: 8, content: 'item 8', start: '2013-05-27'},]);
// Configuration for the Timeline
var options = {
height: '500px'};// Create a Timeline
var timeline = new vis.Timeline(container, items, options);
self.$el.append(QWeb.render('TimelineDashboard', {}))
}) } }) core.action_registry.add('timeline', TimelineDashboard);
return TimelineDashboard;});
My xml:
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="TimelineDashboard">
<div id="visualization"></div>
</t></templates>
I'm loading the vis lib through here:
<template id="gantt_timeline_assets" name="gantt assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/test_timeline/static/lib/vis-timeline-graph2d.min.js"/>
<script type="text/javascript" src="/test_timeline/static/src/js/load_records.js"/> <!-- My js code-->
<link rel="stylesheet" href="/test_timeline/static/lib/vis-timeline-graph2d.min.css"/>
</xpath>
</template>