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

kendo grid does not populating after re-read data

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kornelyuk
Top achievements
Rank 1
Kornelyuk asked on 26 May 2015, 03:03 PM
I use angular kendo grid.

Here is options:

$scope.relatedCasesOptions = {
        dataSource: new kendo.data.DataSource({
            type: 'json',
            transport: {
                read: function (opt) {
                    if ($scope.item)
                        opt.success([{ CaseNumber: "CaseNumber" }]);
                    opt.success([]);
                }
            },
        columns: [
            { field: "CaseNumber", title: "№ дела"}
        ]
    }

 

In other place, when particular event get rose, I call

var cases = $('#docRelatedCaseGrid').data("kendoGrid");
cases.dataSource.read();
cases.refresh();
 

There set breakpoint on  opt.success([{ CaseNumber: "CaseNumber" }]) row and it's possible to observe that read function was really called.
But table are not refreshed and grid still remains empty.

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 28 May 2015, 07:48 AM
Hello Kornelyuk,

This happens because the opt.success([]); statement is always executed. I would suggest using if-else logic instead: 
read: function(opt){
  if ($scope.item){
    opt.success([{ CaseNumber: "CaseNumber" }]);
  }else{
    opt.success([]);
  }

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Kornelyuk
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or