Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jpacareu opened this issue Aug 4, 2017 · 2 comments
Open

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

jpacareu opened this issue Aug 4, 2017 · 2 comments

Comments

@jpacareu
Copy link

jpacareu commented Aug 4, 2017

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

@jpacareu jpacareu changed the title The view is not tree_data is not updating whenever I make a change in my controller The view is not updating whenever I make a change on tree_data Aug 4, 2017
@ramakrishna-y
Copy link

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
Copy link
Author

jpacareu commented Aug 8, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants