khan4019 / tree-grid-directive

Need one or more maintainer for this! comment or email me if you are interested
http://khan4019.github.io/tree-grid-directive/test/treeGrid.html
347 stars 183 forks source link

The view is not updating whenever I make a change on tree_data #146

Open jpacareu opened 7 years ago

jpacareu commented 7 years ago

Hi guys:

My project is quite simple, I'm using Laravel 5 as my back-end framework and I'm doing a simple $http request in a service with AngularJS, I'm receiving the data all fine but when assigning to tree_data, the View(the front) is not updating properly (only one column of the data is shown), I've debugged and the problem is that the call of the tree-grid-directive.js occurs only the first time the page is loaded, Is it suppose to update automatically right? or Am I doing something wrong?


angular.module('treeGridTest', ['treeGrid'])
    .controller('treeGridController', ['$scope', 'TableService',
 function ($scope, TableService) 
{           
            var self = this;
            self.tableShow = false;
            var tree;
            self.fetchTable = function () {

                TableService.list().then(

                    function (resp) {
                        self.rawTreeData = resp.data;
                        $scope.loading = false;
                        $scope.tree_data = self.rawTreeData;
                        self.tableShow = true;
                    },

                    function (respError) {
                        console.log(respError);
                    });
            };

            self.fetchTable();

            $scope.tree_data = [{ empty: "Empty" }]; 

    }])
        .factory('TableService', ['$http', function ($http) 
   {
        return {
            list: function () {
                return $http.get('/api/tables/' + 'ventasporproductos');
                                  }
   };
}]);

Could you please post an example where you change the value of tree_data dynamically with an or something, because I just did something like that and is not updating the table. Thanks in advance

ramakrishna-y commented 7 years ago

I am also having the same issue. I am using AngularJS and initializing the tree_data with an empty array in the beginning. Then I am getting the data using a $http GET and assigning to tree_data. The first column shows (key column) up and all remaining columns are NOT. I have to show quantity date wise and the input data is in the correct format. When I assign the same array in the controller code, it works but not via $http GET assignment.

jpacareu commented 7 years ago

The exact same issue, my solution was found here Check it is way better