2017-04-17 79 views
1
  • 我想添加一个下拉列表到我的“类型”列,我可以选择x,y或z。
  • 当我在下拉列表中选择x,y或z时,x,y,z列的复选框不会更改。
  • 然而,当我检查无论是X,Y或Z复选框,在“类型”列中的downdrop值改变如何处理用户界面的动态下拉菜单?

    { name: 'Type', displayName: 'Type', width: '7%',field:'getType()', editableCellTemplate: 'ui-grid/dropdownEditor', 
         editDropdownValueLabel: 'Type', enableCellEdit: true }, 
    

这里是我的plunker:https://plnkr.co/edit/mzSaxh3PVvqvfJtAYKkU?p=preview

回答

0

这应该做它...

$scope.updateType = function (entity, type) { 
    entity.xBox = type == 'x'; 
    entity.yBox = type == 'y'; 
    entity.zBox = type == 'z'; 
} 

editableCellTemplate: '<select ui-grid-edit-dropdown ng-init="result=row.entity.getType()" ng-options="type for type in [\'x\',\'y\',\'z\']" ng-model="result" ng-change="grid.appScope.updateType(row.entity, result)"></select>' 

你的Plunker更新,https://plnkr.co/edit/SbZkKubGtrzWYJhc8Qv9?p=preview

+0

有趣。这里有一个更新的plunker:[链接](https://plnkr.co/edit/XgT7XxSjpLAK9UJCjhHE?p=preview) 当我检查自己的价值时,我想要Type列反映最后被检查的x,y或z 。 – UCDaCode

+0

忽略先前的评论。这里是更新的评论:plunker:[link](https://plnkr.co/edit/XgT7XxSjpLAK9UJCjhHE?p=preview) 当选择Own Value时,Type列单元应该总是反映最后一个x,y或z没有被检查。当我检查x,y或z框时,类型只反映xyz。如果自己的价值被检查,产品将是自己的价值*数量。在选中“自己的值”时,类型不会反映xy | z。这可能吗?非常感谢你的耐心。 – UCDaCode

+0

我的回答至少有帮助,如果它实际上没有回答你的原始问题? –