kendo-labs / angular-kendo

A project to create a robust set of Angular.js bindings for Kendo UI widgets
474 stars 209 forks source link

Can't Refresh Grid #404

Closed DevQueen closed 8 years ago

DevQueen commented 9 years ago

I have an ng-click in a template on my Grid. The method on the click goes to the SQL Database and makes changes to the dataSource of the grid. I'm trying to refresh the grid after the method executes, but nothing I've tried has worked.

Here is my gridOptions:

$scope.gridOptions = {

    dataSource: {
        transport:{
            read:{
                url:'/SSQV4/SSQV5/Search/GetBusinessUnits',
                type: "GET"
            }
        },
        sort: {field: "intOrder", dir:"asc"}
    },
    batch: false,
    reorderable: true,
    sortable: false,
    editable: "inline",

    columns: [
      { template: '<i class="fa fa-chevron-circle-up" style="cursor:pointer" ng-click="MoveUp(#=OperatorBusinessUnitID#)"></i>&nbsp;&nbsp;&nbsp;<i class="fa fa-chevron-circle-down" style="cursor:pointer"></i>', title: "List Order" },
      { field: "intOrder"},
      { field: "OperatorBusinessUnitID", title: "Business Unit ID" },
      { field: "vchDescription", title: "Business Unit Name" },
      { field: "vchOperatorSystemID", title: "Operator System ID"},
      {
          command: [
            { name: "edit", text: " " },
            { name: "destroy", text: " " },
          ], title: "Action"
      }
    ]

};

Here is the method called by the ng-click:

$scope.MoveUp = function (id) {
    operatorService.moveup(id)
    .success(function (data) {
        $scope.businessUnits = data;
        $scope.grid.dataSource.transport.read();
        $scope.grid.refresh();
    });
};

As you can see, I've tried a couple of different ways to refresh the grid:

<div kendo-grid="grid" k-options="gridOptions" k-rebind="gridOptions"></div>

ANY assistance is greatly appreciated!