appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
33.77k stars 3.63k forks source link

[Feature]: TreeSelect mode #22739

Open vidz1979 opened 1 year ago

vidz1979 commented 1 year ago

Is there an existing issue for this?

Summary

MultiTreeSelect has an excelent feature Mode that allow developers to select which items are selectable (all items, only parent and only child).

TreeSelect doesn't have such feature and should be implemented.

image

Why should this be worked on?

1) It is a very useful feature.

2) It was already implemented in another widget, so feature is already developed and available in Appsmith.

Front logo Front conversations

somangshu commented 1 year ago

@vidz1979 need some understanding on the use case here, the tree select is supposed to only have one selection, i.e. you can only select one option either parent or child. What is the purpose of giving modes here?

vidz1979 commented 1 year ago

Sorry... Indeed, the feature of MultiTreeSelect is different than I supposed.

The purpose here is to allow only the selection of child items.

To overcome this, I wrote a JS like:

// If the selected item is a child item.
if (TreeSelect1.selectedOptionValue.startsWith('I-')) { 
    // ok!
} else {
    resetWidget('TreeSelect1')
    showAlert('Selecione a child item!')
}