josebalius / ngReactGrid

A really fast Angular grid using the power of React to render. Based on ng-grid and jQuery DataTables.
http://josebalius.github.io/ngReactGrid/
MIT License
328 stars 47 forks source link

Handling asynchronous data #9

Closed ewu02 closed 10 years ago

ewu02 commented 10 years ago

Hello. Any plan to implement native support for async data (e.g., promises) without enabling server-side processing? Thanks.

josebalius commented 10 years ago

@ewu02 Hello there, not sure what you mean? Enabling server side will allow you to listen for events when page size, sorting, search and paginations changes are made. Now if you just need to load your data asynchronously for the first time and then treat it as if it was "local" data, you can do something like this:

$scope.grid = {
   ...
   data: []
   ...
};

CrudService.get().then(function(response) {
    $scope.grid.data = response.data
});

The grid will automatically re-render with your new data set. Let me know if this what you needed.

Jose

ewu02 commented 10 years ago

Cool. And yea, I meant treating data acquired asynchronously as local data. Couldn't get it to work before because I was assigning promises object to the data field like ng-grid examples. Thanks a bunch!

josebalius commented 10 years ago

I see, actually I should probably implement that option as well. I'll look into it. Thanks!