title: ngTable not loading data
body: <p>I have two tables in my screen:</p>
  
  <p>(1)</p>
  
  <pre><code>&lt;table id="users" class="widget" ng-table="usersTableParams"&gt;
                      &lt;tr ng-repeat = "user in $data" ng-click="usersClicked($event, user.userId);"&gt;
                          &lt;td &gt;{{user.userId}}&lt;/td&gt;
                          &lt;td &gt;{{user.roleName}}&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
  </code></pre>
  
  <p>(2)</p>
  
  <pre><code>&lt;table class="widget" ng-table="sitesTableParams"&gt;
                      &lt;tr ng-repeat = "site in $data"&gt;
                          &lt;td &gt;{{site.site}}&lt;/td&gt;
                          &lt;td &gt;{{site.country}}&lt;/td&gt;
                          &lt;td &gt;{{site.region}}&lt;/td&gt;
                          &lt;td &gt;{{site.selected == true ? "Yes" : "No"}}&lt;/td&gt;
                          &lt;td &gt;
                              &lt;input type="checkbox" ng-checked="{{site.selected}}" ng-model="site.selected"&gt;&lt;/input&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
  </code></pre>
  
  <p>My script for loading data in two tables:</p>
  
  <pre><code>$scope.users =[];
  $scope.sitesAssigned =[];   
  
  $scope.selectedUsers = {
              users: []
          };
  
  
  $scope.usersTableParams = new ngTableParams({
              page: startPage,
              count: rowsPerPage,
              sorting: {
                  userId: 'asc'
              },
              filter: {
                  userId: '',
                  roleName:''
              }
          },
          {
              total: $scope.users.length,
              getData: function($defer, params){
                  var orderedData = getFilteredSortedData($scope.users, params);
                  params.total(orderedData.length);
                  var slicedData = getSlicedData(orderedData,params);
                  if(null != slicedData &amp;&amp; slicedData.length &gt; 0){
                      var user = slicedData[0];
                      if(user.hasOwnProperty('userId')){
                          $scope.selectedUsers.users.push(user.userId);
                          console.log('Selected User: '+JSON.stringify($scope.selectedUsers));
                      }
                  }
                  $defer.resolve(slicedData);
              }
          });
  
  
          $scope.sitesTableParams = new ngTableParams({
              page: startPage,
              count: rowsPerPage,
              sorting: {
                  site: 'asc'
              },
              filter:{
                  site: '',
                  country: '',
                  region: ''
              }
          },
          {
              total: $scope.sitesAssigned.length,
              getData: function($defer, params){
                  var orderedData = getFilteredSortedData($scope.sitesAssigned, params);
                  params.total(orderedData.length);
                  var slicedData = getSlicedData(orderedData, params);
                  $defer.resolve(slicedData);
              }
          }); 
  $scope.$watch('sitesTableParams', function(newValue, oldValue){
              console.log('Old value of sitesTableParams: '+JSON.stringify(oldValue));
              console.log('New value of sitesTableParams: '+JSON.stringify(newValue));
          }, true);
  
              $scope.$watch('selectedUsers', function(newValue, oldValue){
              console.log('Old value of selected users: '+JSON.stringify(oldValue));
              console.log('New value of selected users: '+JSON.stringify(newValue));
              var users = $scope.selectedUsers.users[0];
              console.log('Fetch sites assigned to user: '+users);
              console.log('Sites table params before fetching sites data: '+JSON.stringify($scope.sitesTableParams));
              mlmSiteAssignments.getSites(users).then(function(data){ 
                  console.log('List of sites received from service: '+JSON.stringify(data));
                  angular.forEach(data, function(site ){
                      $scope.sitesAssigned.push({
                          site: site.site,
                          country: site.country,
                          region: site.region,
                          selected: site.selected
                      });
                  });
                  $scope.sitesTableParams.data = $scope.sitesAssigned;
                  $scope.siteAssignmentsTableParams.reload();
                  console.log('Sites table params after fetching sites data: '+JSON.stringify($scope.sitesTableParams));
              });
  
          }, true);
  
  
  
          var getFilteredSortedData = function(data, params) {
              if (params.filter()) {
                  data = $filter('filter')(data, params.filter());
              }
              if (params) {
                  data = params.sorting() ? $filter('orderBy')(data, params.orderBy()) : data;
              }
              return data;
          };
  
          var getSlicedData = function(data, params) {
               var slicedData = data.slice((params.page() - 1) * params.count(), params.page() * params.count());
               return slicedData;
          };
  </code></pre>
  
  <p>On click of a row in 'usersTableParams' the data in 'sitesTableParams' should be loaded. On the click of a row in 'usersTableParams' I am getting the data for second table, but the so obtained data is not getting rendered in the page.</p>
  
  <p>I have been stuck in this issue for several days and unable to find any solution. Any suggestions / corrections / pointers are welcome. </p>
  
  <p>When ran the above code, the console says:</p>
  
  <pre><code>Old value of sitesTableParams: {"data":[],"$params":{"page":1,"count":10,"filter":{"site":"","country":"","region":""},"sorting":{"site":"asc"},"group":{},"groupBy":null},"filterBuffer":{}}
  New value of sitesTableParams: {"data":[],"$params":{"page":1,"count":10,"filter":{"site":"","country":"","region":""},"sorting":{"site":"asc"},"group":{},"groupBy":null},"filterBuffer":{}}
  Old value of selected users: {"users":[]}
  New value of selected users: {"users":[]}
  Fetch sites assigned to user: undefined
  Sites table params before fetching sites data: {"data":[],"$params":{"page":1,"count":10,"filter":{"site":"","country":"","region":""},"sorting":{"site":"asc"},"group":{},"groupBy":null},"filterBuffer":{}}
  List of sites received from service: []
  Sites table params after fetching sites data: {"data":[],"$params":{"page":1,"count":10,"filter":{"site":"","country":"","region":""},"sorting":{"site":"asc"},"group":{},"groupBy":null},"filterBuffer":{}}
  Selected User: {"users":["abc.COM"]}
  Old value of selected users: {"users":[]}
  New value of selected users: {"users":["abc.COM"]}
  Fetch sites assigned to user: abc.COM
  Sites table params before fetching sites data: {"data":[],"$params":{"page":1,"count":10,"filter":{"site":"","country":"","region":""},"sorting":{"site":"asc"},"group":{},"groupBy":null},"filterBuffer":{}}
  List of sites received from service: [DATA ARRAY]
  Sites table params after fetching sites data: {"data":[],"$params":{"page":1,"count":10,"filter":{"site":"","country":"","region":""},"sorting":{"site":"asc"},"group":{},"groupBy":null},"filterBuffer":{}}
  </code></pre>
  
  <p>So the log indicates that even if I got the data in the variable that I am using for populating the data, the watcher for sites table is not called. This implies that the data is not provided to sites table params. Any explanation why this could be happening.</p>