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

Show the destroyed data - e.fetch is not a function

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Veteran
Iron
Chris asked on 11 Apr 2017, 09:20 AM

HI

How could I show the destroyed data in another Grid ?

I have met an error : 

grid2.setDataSource(grid.dataSource._destroyed);

Uncaught TypeError: e.fetch is not a function at init.setDataSource (kendo.all.min.js:48)


Best regards

Chris

 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 13 Apr 2017, 08:44 AM
Hello Chris,

The setDataSource method of the Grid accepts a DataSource instance as an argument. The _destroyed collection is an array, so you should not pass it directly. If what you are trying to do is display deleted items while doing Batch editing in the Grid, my advice is to go with the following cleaner approach.

1) Handle the Grid remove event.
@(Html.Kendo().Grid(Model)
      .Name("grid")
      .Events(e => e
          .Remove("grid_remove")
      )
)

2) In the remove event, get the currently deleted item and add it to the second Grid:
function grid_remove(e){
  var item = e.model,
    grid2= $("#grid2").data("kendoGrid");
 
  grid2.dataSource.add(item.toJSON());
}

I am using toJSON method of the model to get only the clear data, without the Model properties.

Here is a sample client-side implementation for your reference:
http://dojo.telerik.com/@tsveti/asIna/5

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Veteran
Iron
Answers by
Tsvetina
Telerik team
Share this question
or