Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 通过另一个网格选择填充ng网格_Angularjs_Angular Ui_Ng Grid - Fatal编程技术网

Angularjs 通过另一个网格选择填充ng网格

Angularjs 通过另一个网格选择填充ng网格,angularjs,angular-ui,ng-grid,Angularjs,Angular Ui,Ng Grid,我试图基于从第一个ng网格选择返回的JSON数组填充ng网格。到目前为止,我可以在屏幕上显示JSON数组,但我无法深入到JSON数组中,也无法在第二个网格中显示任何内容。我有控制器代码附加和plnkr可以找到在 “严格使用”; 函数ArticleDataCtrl($rootScope,$scope,articleDataService){ articleDataService .getArticles() .那么( 职能(条款){ $rootScope.articles=文章; $scope.a

我试图基于从第一个ng网格选择返回的JSON数组填充ng网格。到目前为止,我可以在屏幕上显示JSON数组,但我无法深入到JSON数组中,也无法在第二个网格中显示任何内容。我有控制器代码附加和plnkr可以找到在

“严格使用”;
函数ArticleDataCtrl($rootScope,$scope,articleDataService){
articleDataService
.getArticles()
.那么(
职能(条款){
$rootScope.articles=文章;
$scope.articleGridItems=articles.data.specialMerchandise.specialMerItem;
});
$scope.articleGrid={
数据:“articleGridItems”,
showGroupPanel:false,
多选:对,
checkboxHeaderTemplate:“”,
showSelectionCheckbox:true,
仅选择WithCheckbox:true,
enableColumnResize:true,
selectedItems:[],
columnDefs:[{
字段:“soMerArticleNbr”,
displayName:“文章”
}, {
字段:“soMerOrdQty”,
显示名称:“数量”
}, {
字段:“soArtDeliveryCode”,
displayName:“交付代码”
}, {
字段:“dsgnSysRecDesc”,
displayName:'说明'
}]
};
//单击页眉模板时未调用此项
$scope.getDeliveryLocations=函数(){
$scope.deliveryLocationData=$scope.commonDeliveryLocations;
};
$scope.selections=$scope.articleGrid.selectedItems;
var jsonObject=JSON.stringify($scope.selections);
//我以为这里发生了json问题……是错的
$scope.test=jsonObject.deliveryLocations;
$scope.deliveryGrid={
数据:“选择”,
showGroupPanel:false,
多选:错,
columnDefs:[{
displayName:“传递方法”
}]
};
}
myApp.controller('ArticleDataCtrl',['$rootScope','$scope',',
“articleDataService”,ArticleDataCtrl
]);

因此,我没有尝试使用angular的内置复选框,而是在单击时使用了我自己的自定义方法。下面是代码和plunker,演示了该功能

“严格使用”;
函数ArticleDataCtrl($rootScope,$scope,articleDataService){
articleDataService
.getArticles()
.那么(
职能(条款){
$rootScope.articles=文章;
$scope.articleGridItems=articles.data.specialMerchandise.specialMerItem;
});
$scope.articleGrid={
数据:“articleGridItems”,
showGroupPanel:false,
多选:错,
enableColumnResize:true,
仅选择WithCheckbox:true,
columnDefs:[{
/*
headerCellTemplate:myHeaderCellTemplate,
*/
单元格模板:“”
}, {
字段:“soMerArticleNbr”,
displayName:“文章”
}, {
字段:“soMerOrdQty”,
显示名称:“数量”
}, {
字段:“someruidesc”,
显示名称:“计量单位”
}, {
字段:“soArtDeliveryCode”,
displayName:“交付代码”
}, {
字段:“soMerShrtMerDesc”,
displayName:'说明'
}, {
字段:“soMerDesc”,
displayName:'供应商'
}]
};
$scope.getDeliveryLocation=函数(deliveryLocation){
$scope.deliveryLocationData=deliveryLocation.deliveryLocation;
对于(变量i=0;i<$scope.deliveryLocationData.length;i++){
var locationId=$scope.deliveryLocationData[i].dlvryLocId;
var locationDesc=$scope.deliveryLocationData[i].dlveryLocDesc;
$scope.deliveryLocationData[i].dlvryLocId=locationId+locationDesc;
}
返回$scope.deliveryLocationData;
};
返回$scope.deliveryLocationData;
};
$scope.deliveryGrid={
数据:“deliveryLocationData”,
showGroupPanel:false,
多选:错,
columnDefs:[{
字段:“dlvryLocId”,
displayName:“传递方法”
}]
};
$scope.customerGroup={
价值观:“DIY”
};
}
myApp.controller('ArticleDataCtrl',['$rootScope','$scope',',
“articleDataService”,ArticleDataCtrl
]);

因此,我没有尝试使用angular的内置复选框,而是在单击时使用了我自己的自定义方法。下面是代码和plunker,演示了该功能

“严格使用”;
函数ArticleDataCtrl($rootScope,$scope,articleDataService){
articleDataService
.getArticles()
.那么(
职能(条款){
$rootScope.articles=文章;
$scope.articleGridItems=articles.data.specialMerchandise.specialMerItem;
});
$scope.articleGrid={
数据:“articleGridItems”,
showGroupPanel:false,
多选:错,
enableColumnResize:true,
仅选择WithCheckbox:true,
columnDefs:[{
/*
headerCellTemplate:myHeaderCellTemplate,
*/
单元格模板:“”
}, {
字段:“soMerArticleNbr”,
displayName:“文章”
}, {
字段:“soMerOrdQty”,
显示名称:“数量”
}, {
字段:“someruidesc”,
显示名称:“计量单位”
}, {
字段:“soArtDeliveryCode”,
displayName:“交付代码”
}, {
字段:“soMerShrtMerDesc”,
displayName:'说明'
}, {
字段:“soMerDesc”,
displayName:'供应商'
}]
};
$scope.getDeliveryLocation=函数(deliveryLocation){
$scope.deliveryLocationData=deliveryLocation.deliveryLocation;
对于(变量i=0;i<$scope.deliveryLocationData.length;i++){
var locationId=$scope.deliveryLocationData[i].dlvryLocId;
var locationDesc=$scope.deliveryLocationData[i].dlveryLocDesc;
$scope.deliveryLocationData[i].dlvryLocId=locationId+locationDesc;
}
返回$scope.deliveryLocationData;
};
返回$scope.deliveryLocationData;
};
$scope.deliveryGrid={
数据:“deliveryLocationData”,
showGroupPanel:false,
多选:错,
columnDefs:[{
字段:“dlvryLocId”,
displayName:“传递方法”
}]
};
$scope.customerGroup={
价值观:“DIY”
};
}
myApp.controller('ArticleDataCtrl',['$rootScope','$scope',',
“艺术
'use strict';

function ArticleDataCtrl($rootScope, $scope, articleDataService) {
  articleDataService
    .getArticles()
    .then(
      function(articles) {
        $rootScope.articles = articles;
        $scope.articleGridItems = articles.data.specialMerchandise.specialMerItem;
      });

  $scope.articleGrid = {
    data: 'articleGridItems',
    showGroupPanel: false,
    multiSelect: true,
    checkboxHeaderTemplate: '<input class="ngSelectionHeader" type="checkbox" ng-click="getDeliveryLocations()" ng-model="allSelected" ng-change="toggleSelectAll(allSelected)"/>',
    showSelectionCheckbox: true,
    selectWithCheckboxOnly: true,
    enableColumnResize: true,
    selectedItems: [],
    columnDefs: [{
      field: 'soMerArticleNbr',
      displayName: 'Article'
    }, {
      field: 'soMerOrdQty',
      displayName: 'Qty'
    }, {
      field: 'soArtDeliveryCode',
      displayName: 'Delivery Code'
    }, {
      field: 'dsgnSysRecDesc',
      displayName: 'Description'
    }]
  };

//This is not being called on header template click
  $scope.getDeliveryLocations = function() {
    $scope.deliveryLocationData = $scope.commonDeliveryLocations;
  };

  $scope.selections = $scope.articleGrid.selectedItems;
  var jsonObject = JSON.stringify($scope.selections);
  //Thought a json problem occured here...was wrong
  $scope.test = jsonObject.deliveryLocations;


  $scope.deliveryGrid = {
    data: 'selections',
    showGroupPanel: false,
    multiSelect: false,
    columnDefs: [{
      displayName: 'Delivery Methods'
    }]
  };
}

myApp.controller('ArticleDataCtrl', ['$rootScope', '$scope',
  'articleDataService', ArticleDataCtrl
]);
'use strict';

function ArticleDataCtrl($rootScope, $scope, articleDataService) {
  articleDataService
    .getArticles()
    .then(
      function(articles) {
        $rootScope.articles = articles;
        $scope.articleGridItems = articles.data.specialMerchandise.specialMerItem;
      });

  $scope.articleGrid = {
    data: 'articleGridItems',
    showGroupPanel: false,
    multiSelect: false,
    enableColumnResize: true,
    selectWithCheckboxOnly: true,
    columnDefs: [{
      /*
            headerCellTemplate: myHeaderCellTemplate,
            */
      cellTemplate: '<input id="checkSlave" name="articleCheckBox" ng-checked="master" type="checkbox" ng-click="getDeliveryLocation(row.entity)" />'

    }, {
      field: 'soMerArticleNbr',
      displayName: 'Article'
    }, {
      field: 'soMerOrdQty',
      displayName: 'Qty'
    }, {
      field: 'soMerUOIDesc',
      displayName: 'UOM'
    }, {
      field: 'soArtDeliveryCode',
      displayName: 'Delivery Code'
    }, {
      field: 'soMerShrtMerDesc',
      displayName: 'Description'
    }, {
      field: 'soMerDesc',
      displayName: 'Vendor'
    }]
  };

  $scope.getDeliveryLocation = function(deliveryLocation) {
    $scope.deliveryLocationData = deliveryLocation.deliveryLocation;
    for (var i = 0; i < $scope.deliveryLocationData.length; i++) {
      var locationId = $scope.deliveryLocationData[i].dlvryLocId;
      var locationDesc = $scope.deliveryLocationData[i].dlveryLocDesc;
      $scope.deliveryLocationData[i].dlvryLocId = locationId + locationDesc;
    }
    return $scope.deliveryLocationData;
  };

    return $scope.deliveryLocationData;
  };


  $scope.deliveryGrid = {
    data: 'deliveryLocationData',
    showGroupPanel: false,
    multiSelect: false,
    columnDefs: [{
      field: 'dlvryLocId',
      displayName: 'Delivery Methods'
    }]
  };

  $scope.customerGroup = {
    value: 'DIY'
  };
}

myApp.controller('ArticleDataCtrl', ['$rootScope', '$scope',
  'articleDataService', ArticleDataCtrl
]);