콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
4231 화면

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>
아바타
취소
작성자 베스트 답변

I solved by just rendering the qweb before the vis.js code, my mistake. Just for the record: ODOO community barely answers my questions and the documentaction of the JS framework doesn't help much and because of the monolithic architecture I'm almost given up of using odoo.


아바타
취소
관련 게시물 답글 화면 활동
2
2월 20
5901
0
12월 19
4170
1
6월 24
3491
1
3월 22
1925
0
8월 21
3317