1
我試圖在UI-Grid中創建一個自定義下拉編輯器。我已經關注了Brian Hahn的博客文章。UI-Grid v3.1.1 dropdownEditor過濾器綁定
我有,只是我想不通的是在gridOptions定義cellFilter綁定它主要的工作,我想具體地利用每一列的colDef之一。
E.g.代碼:
<ui-select-wrap>
<ui-select ng-model="MODEL_COL_FIELD" ng-disabled="disabled" append-to-body="true" autofocus="true">
<ui-select-match placeholder="Choose...">{{ MODEL_COL_FIELD | filter: col.cellFilter}}</ui-select-match>
<ui-select-choices
repeat="item[editDropdownIdLabel] as item in editDropdownOptionsArray | filter: $select.search">
<span>{{ item[editDropdownValueLabel] }}</span>
</ui-select-choices>
</ui-select>
</ui-select-wrap>
由於某種原因,當我嘗試從col.cellFilter調用它時,它沒有調用過濾器。我希望像MODEL_COL_FIELD那裏有一些我可以參考的綁定,但我似乎無法找到它。
編輯:添加我的網格選項。
vm.gridOptions = {
showGridFooter: true,
rowHeight: 40,
enableCellEditOnFocus: true
};
vm.gridOptions.columnDefs = [
{name: 'id', enableCellEdit: false},
{name: 'name', displayName: 'Name (editable)'},
{name: 'age', displayName: 'Age', type: 'number'},
{
name: 'list',
displayName: 'List',
editableCellTemplate: 'app/index/templates/uiSelect.tpl.html',
cellFilter: 'listFilter',
enableCellEditOnFocus: true
},
{
name: 'checkbox',
displayName: 'Checkbox',
type: 'boolean',
cellTemplate: '<input type="checkbox" ng-model="MODEL_COL_FIELD">'
}
];
它似乎不像cellFilter在我的自定義下拉列表中應用。我已經嘗試使用CUSTOM_FILTERS,如模板中所示。
<ui-select-match placeholder="Choose...">{{ COL_FIELD CUSTOM_FILTERS }}</ui-select-match>
即使我在gridOption columnDefs定義cellFilters當我檢查CUSTOM_FILTERS變量,它回來爲未定義。
編輯的最新信息原題 – Wes