1
  • I’m trying to add a dropdown to my “Type” column where I can select either x, y, or z.
  • When I select x, y, or z in the dropdown, the checkboxes for the x, y, z columns don’t change.
  • However, when I check the either x,y or z checkboxes, the downdrop value in the “Type” column changes

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

Here's my plunker: https://plnkr.co/edit/mzSaxh3PVvqvfJtAYKkU?p=preview

AT82
  • 71,416
  • 24
  • 140
  • 167
UCDaCode
  • 65
  • 7

1 Answers1

0

This should do it...

$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>'

Your Plunker updated, https://plnkr.co/edit/SbZkKubGtrzWYJhc8Qv9?p=preview.

Tim Harker
  • 2,367
  • 1
  • 15
  • 28
  • Interesting. Here's an updated plunker: [link](https://plnkr.co/edit/XgT7XxSjpLAK9UJCjhHE?p=preview) When I check Own Value, I want the Type column to reflect the last x,y,or z that was checked. – UCDaCode Apr 20 '17 at 00:44
  • Ignore the previous comment. Here's the updated comment: plunker: [link](https://plnkr.co/edit/XgT7XxSjpLAK9UJCjhHE?p=preview) When Own Value is checked, the Type column cell should always reflect the last x,y,or z that was unchecked. Type only reflects xyz when I check either x,y, or z boxes. If Own value is checked, the product would be Own Value * qty. Type is not reflecting xy|z when Own Value is checked. Is this possible? Thank you so much for your patience. – UCDaCode Apr 20 '17 at 01:09
  • Was my answer above helpful at least, if it didn't actually answer your original question? – Tim Harker May 04 '17 at 20:02