0

データベースからangularjs ui-gridのサブグリッドにデータを入力しようとしていますが、機能していませんこれはコードです

`var User = $resource('/rest/daybook/sales_registertest/:id/?app_name=DAYBOOK_NEW&fields=*', {}, { update: { method: 'PUT' }, query: { method: 'GET', isArray : 間違い } });

var User1 = $resource('/rest/daybook/salesdetailtest/:id/?app_name=DAYBOOK_NEW&fields=*', {}, { update: { method: 'PUT' }, query: { method: 'GET', isArray:間違い } });

User.get(function(data) {

      for(i = 0; i < 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;


  }

$scope.gridOptions.data=data.record; }、関数(エラー){

});`

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 ??

4

1 に答える 1

-1
$http.get('/data/500_complex.json')
    .success(function(data) {
      for(i = 0; i < data.length; i++){
       //parse the data object and check the database for any relations then grab those as an object and push it into the data[i].subGridOptions
        data[i].subGridOptions = {
          columnDefs: [ {name:"Id", field:"id"},{name:"Name", field:"name"} ],
          data: data[i].friends
        }
      }
      $scope.gridOptions.data = data;
    });
于 2015-01-09T07:30:42.480 に答える