We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用d-cascader组件时,有时虽然是叶子节点(isLeaf:true),但是业务逻辑上需要禁止选择。建议组件增加一个回调函数,返回true则选择成功,返回false则选择失败。或者直接在CascaderItem类型上面增加一个属性canSelectable:boolean;用来控制是否可以选择。
如果增加回调函数: <d-cascader [options]="options" [(ngModel)]="value" [canSelectable]=canSelect
或者在CascaderItem类型增加canSelectable:boolean属性: interface CascaderItem { label: string; value: number | string; isLeaf?: boolean; children?: CascaderItem[]; canSelectable:boolean disabled?: boolean; icon?: string; // 用户可以传入自定义属性,并在dropDownItemTemplate中使用 [prop: string]: any; }
The text was updated successfully, but these errors were encountered:
没理解,你要禁止选择直接设置节点disabled就可以吧
Sorry, something went wrong.
比如员工列表, 有些部门没有员工, 那叶子节点就是部门, 应该是不能选择, 而总不能把所有的部门都设置为disable
没理解,你要禁止选择直接设置节点disabled就可以吧 比如员工列表, 有些部门没有员工, 那叶子节点就是部门, 应该是不能选择, 而总不能把所有的部门都设置为disable
禁用是针对单个节点,而不是某一类,数据在你手里,你把没有子的部门禁用了就好。
No branches or pull requests
What problem does this feature solve
使用d-cascader组件时,有时虽然是叶子节点(isLeaf:true),但是业务逻辑上需要禁止选择。建议组件增加一个回调函数,返回true则选择成功,返回false则选择失败。或者直接在CascaderItem类型上面增加一个属性canSelectable:boolean;用来控制是否可以选择。
What does the proposed API look like
如果增加回调函数:
canSelect(value:number|string):boolean;<d-cascader
[options]="options"
[(ngModel)]="value"
[canSelectable]=canSelect
或者在CascaderItem类型增加canSelectable:boolean属性:
interface CascaderItem {
label: string;
value: number | string;
isLeaf?: boolean;
children?: CascaderItem[];
canSelectable:boolean
disabled?: boolean;
icon?: string;
// 用户可以传入自定义属性,并在dropDownItemTemplate中使用
[prop: string]: any;
}
The text was updated successfully, but these errors were encountered: