Vue Kendo-Gantt问题“ TypeError:dataSource.fetch不是函数”

时间:2019-06-19 02:44:02

标签: javascript kendo-ui solution vue-cli kendo-gantt

这不是问题,而是将JSON传递给Kendo-Gantt数据源标记时解决该问题的方法。

<kendo-gantt id="gantt"
     :height="700"
     :data-source="myData"
 >
</kendo-gantt>

当我们将JSON数据传递给kendo-gantt时,必须将其呈现给视图。在这种情况下,尽管信息未正确处理,但仍以相同方式显示数据。但是,当我们在“天”,“周”,“月”之间切换视图时,数据消失并显示此错误:

Error in callback for watcher "dataSource": "TypeError: dataSource.fetch is not a function"

解决方案: 解决方案是更改node_modules中的kendo.gant.js文件。 具体路线为:

node_modules/@progress/kendo-ui/js/kendo.gant.js

在此,必须将关键字“ this”添加到下一个功能:

setDataSource: function(dataSource) {
                this.options.dataSource = dataSource;

                this._dataSource();

                this.list._setDataSource(this.dataSource);

                if (this.options.autoBind) {
                    dataSource.fetch();    // fix this line
                }
            },

必须

setDataSource: function(dataSource) {
                this.options.dataSource = dataSource;

                this._dataSource();

                this.list._setDataSource(this.dataSource);

                if (this.options.autoBind) {
                    this.dataSource.fetch();
                }
            },

希望对您有帮助。

0 个答案:

没有答案