[操作疑難] [Solved] angularJS ui-grid filter option 共用問題

本帖最後由 gamezz 於 2016-12-21 16:57 編輯

我用緊 angularJS ui-grid,
佢個 ui filter 會轉換data入面d id 變成string(male/female),
而佢 define option list 又會有一set重複 data,
我想轉成load api 去get option list,可行嗎?

http://ui-grid.info/docs/#/tutorial/201_editable
  1. { name: 'gender', displayName: 'Gender', editableCellTemplate: 'ui-grid/dropdownEditor', width: '20%',
  2.       cellFilter: 'mapGender', editDropdownValueLabel: 'gender', editDropdownOptionsArray: [
  3.       { id: 1, gender: 'male' },
  4.       { id: 2, gender: 'female' }
  5.     ] },

  6. ...

  7. .filter('mapGender', function() {
  8.   var genderHash = {
  9.     1: 'male',
  10.     2: 'female'
  11.   };
複製代碼
** Got the solution:
http://lihung00.blogspot.hk/2015/07/angular-ui-grid-value-id.html

相關文章