设置新数据源后,Kendo Grid不会刷新

时间:2018-03-08 13:41:02

标签: angularjs kendo-ui kendo-grid

我使用kendo gridangular 1.x,我根据用户输入用新数据填充网格。第一个数据设置和工作,第二个搜索不更新表。以下是我设置数据源的方法:

    $scope.search = function () {
        dataService.getData(searchQuery).then(function (res) {
            $scope.isLoading = false;
            if (res === false) {
                $scope.dataError = true;
            }else {
                $scope.dataError = false;
                $scope.noDataError = false;
                drawTable(res);
            }
        });
    }

function drawTable(res) {

    $scope.mainGridOptions = {
        dataSource: { data: res, pageSize: 10 },
        autoBind: true,
        height: 550,
        groupable: true,
        sortable: true,
        pageable: {
            refresh: true,
            pageSizes: true,
            buttonCount: 5,
            pageSizes: [5, 10, 50, 100, 'All']
        },
        columns: [{
            field: "ID",
            title: "id",
            width: 150
        }, {
            field: "ExtractedText",
            title: "text",
            width: 300
        }, {
            field: "DateTimeAppCreated",
            title: "date created",
            width: 200
        }]
    };
}

1 个答案:

答案 0 :(得分:0)

请浏览此链接:

$ scope.mainGridOptions.datasource.transport.read();

How to call refresh() on a kendo-grid from an Angular controller?