title: how to populate the data into the sub-grid of ui-grid from database
body: <p>i am trying to populate the data from database into the sub-grid of angularjs ui-grid but its not working this is the code</p>
  
  <p>`var User = $resource('/rest/daybook/sales_registertest/:id/?app_name=DAYBOOK_NEW&amp;fields=*', {}, { update: { method: 'PUT' }, query: {
          method: 'GET',
          isArray: false
      } });</p>
  
  <p>var User1 = $resource('/rest/daybook/salesdetailtest/:id/?app_name=DAYBOOK_NEW&amp;fields=*', {}, { update: { method: 'PUT' }, query: {
          method: 'GET',
          isArray: false
      } });</p>
  
  <pre><code>User.get(function(data) {
  
        for(i = 0; i &lt; data.record.length; i++){
            var records;
         var id=data.record[i].sales_id;
      User1.get({
       sales_id: id
        }, function(resp) {
          // Handle successful response here
          records=resp.record;
          console.log(records);
        }, function(err) {
              // Handle error here
         });
            //alert(id);
      data.record[i].subGridOptions = {
        columnDefs: [ 
            {field:'sales_id'},
            {field:'product_id'},
            {field:'sale_qty'}, 
            {field:'sale_price'}, 
            {field:'sale_amount'}, 
            {field:'product_id'} ,
            {field:'updated_on'} 
        ]  
      };
      data.record[i].subGridOptions.data=records;
  
  
    }
  </code></pre>
  
  <p>$scope.gridOptions.data=data.record;
  }, function(err) {</p>
  
  <p>});`</p>
  
  <p>what i need to do is ,to get the sub-grid according to the id of the row in main grid from a different table.  how can i achieve this ??</p>