This is a migrated thread and some comments may be shown as answers.

Refresh local datasource

1 Answer 65 Views
This is a migrated thread and some comments may be shown as answers.
Xamu
Top achievements
Rank 1
Xamu asked on 10 Aug 2018, 11:23 AM

Hello, i would like change my old arr with new, but I have error: dataSource.fetch is not a function. 
Here is plnkr

 

  data: {
      localdatasource: [{
              id: 0,
              orderId: 0,
              parentId: null,
              title: "Main Project",
              summary: true,
              expanded: true,
              start: new Date("2014/6/17 9:00"),
              end: new Date("2014/6/17 15:00")
          }]
}
 
methods: {
    go: function(){
      //How can i do sth like that
          this.localdatasource = [{
              id: 0,
              orderId: 0,
              parentId: null,
              title: "New",
              summary: true,
              expanded: true,
              start: new Date("2014/6/17 9:00"),
              end: new Date("2014/6/17 15:00")
      }]
       
      this.localdatasource[0].title = "Nowy";
    }
}

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 14 Aug 2018, 08:36 AM
Hello Xamu,

In order to achieve the desired functionality, you should use the Client API of the widget and change the needed field, using the setter:

new Vue({
    el: '#vueapp',
        data: {
            localdatasource: [{
                    id: 0,
                    orderId: 0,
                    parentId: null,
                    title: "Main Project",
                    summary: true,
                    expanded: true,
                    start: new Date("2014/6/17 9:00"),
                    end: new Date("2014/6/17 15:00")
                }]
      },
       
      methods: {
          go: function(){
             
           var gantt = this.$refs.gantt.kendoWidget();
            
            gantt.dataSource.get(0).set("title", "Nowy")
          }        
      },
      watch: {
        localdatasource(val){
         // this.refs.gantt.kendoGantt().setDataSource(val);
        }
      }
})

Hope this would help.

Regards,
Nencho
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Xamu
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or