Tree select/check value #67
Replies: 3 comments 1 reply
-
leaf only Reasons: |
Beta Was this translation helpful? Give feedback.
-
Agreed to @fantasywind suggestion. And, in my mind, the data structure will be something like: const value = ['soda', 'juice', 'tea'];
<Drink checked={exact ? value.includes('drink') : childrenAllSelected}>
<Soda checked={value.includes('soda')} />
<Juice checked={value.includes('juice')} />
<Tea checked={value.includes('tea')} />
</Drink> If we set const structure = [{
key: 'drink',
exact: true, // when set this to true, it will be checked only when 'drink' appeared in source `value`
children: [{
key: 'soda'
}]
}]; or simply apply exact mode to all <Tree exactMode /> Hmmmm... will this structure too complicated ? |
Beta Was this translation helpful? Give feedback.
-
Cool. I'll go with |
Beta Was this translation helpful? Give feedback.
-
Pardon me for poor English在有子節點(非 leaf) 的情況時,select 或 check 的時候,最終的 value 需包含各個 node 的 value 還是只要 leaf 的 value?
舉例來說:分類
drinks
底下包含soda
、juice
、tea
。當我點選drinks
的 checkbox(這時候飲料、可樂、果汁、茶類都選取了),最終的 value 會是['drinks', 'soda', 'juice', ''tea]
還是['soda', 'juice', 'tea']
?Ant Design 或 MMA 的做法是前者(包含節點 value)。還是說,要做一個可以 prop 讓這兩種行為可以被決定?
Beta Was this translation helpful? Give feedback.
All reactions