在 Angular ag-grid 中,如何禁用下拉列表中的某些值选择
我可以将值作为数组传递到下拉列表,但是我希望某些值对于用户来说是不可选择的(禁用状态)。原因是,我希望能够根据用户权限切换这些值的禁用状态。
按列定义如下:-
this.columnDefs.push({
headerName: this.FIELD_NAME.toUpperCase(),
field: this.FIELD_NAME,
cellStyle: getBackgroundColor,
editable: true,
cellClass: cellClass,
headerTooltip: this.DESCRIPTION,
cellEditor: 'agSelectCellEditor',
cellEditorParams: {
values: this.approvalStatus
}
})
数组如下:-
approvalStatus: any[] = [{name: 'Not Started',disable: false},{name: 'Work In Progress',disable: false},
{name: 'On Hold',disable: false},{name: 'Pending',disable: true},
{name: 'Completed',disable: true}];
我希望用户能够看到下拉列表中的所有 5 个选项,但无法选择“待处理”和“待处理”。 '完全的'。
我做错了什么或者在这种情况下我需要使用不同的 cellEditor 吗?
I am able to pass values to a dropdown as an array, however I would like for some of the values to be non selectable to the user(disabled state). The reason being, I want to be able to toggle the disabled state of these values based on the users permissions.
By column definition is as below :-
this.columnDefs.push({
headerName: this.FIELD_NAME.toUpperCase(),
field: this.FIELD_NAME,
cellStyle: getBackgroundColor,
editable: true,
cellClass: cellClass,
headerTooltip: this.DESCRIPTION,
cellEditor: 'agSelectCellEditor',
cellEditorParams: {
values: this.approvalStatus
}
})
and the array is as follows :-
approvalStatus: any[] = [{name: 'Not Started',disable: false},{name: 'Work In Progress',disable: false},
{name: 'On Hold',disable: false},{name: 'Pending',disable: true},
{name: 'Completed',disable: true}];
I would like the user to be able to see all 5 options in the dropdown but not be able to select 'Pending' & 'Completed'.
Am I doing anything wrong or do I need to use a different cellEditor in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论