Skip to content

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

Open
@jpacareu

Description

@jpacareu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions