Skip to content
New issue

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

Cascader return results in random order #67

Open
rsheftel opened this issue Aug 28, 2024 · 1 comment
Open

Cascader return results in random order #67

rsheftel opened this issue Aug 28, 2024 · 1 comment

Comments

@rsheftel
Copy link

rsheftel commented Aug 28, 2024

First thank you very much for this excellent library. I am using the cascader component with options of multiple=False and other other options the default. When I use it with two items the return list is in the correct order, but when I add the third item, the order of the list of returned items becomes random such that there is no way to map the return items list to the initial options.

Here is an example. If we run this code

import streamlit as st
from streamlit_antd_components import CasItem, cascader

items = [
    CasItem(
        "first",
        children=[CasItem("US", children=[CasItem("second", children=[CasItem("inter1", children=[CasItem("final1")])]),
                                          CasItem("third", children=[CasItem("inter2", children=[CasItem("final2")])]),
                                          CasItem("forth", children=[CasItem("inter3", children=[CasItem("final3")])]),
                                          CasItem("fifth", children=[CasItem("inter4", children=[CasItem("final4")])]),
                                          CasItem("sixth", children=[CasItem("inter5", children=[CasItem("final5")])])
                                          ],
                          )
                  ],
    ),
]

result = cascader(items, multiple=False)
st.write(result)

And then select the following from the cascader:

image

The return list is in the order

["first", "US", "final3", "forth", "inter3"]

When I would have expected the order of the result to be consistent with the display of the cascader:

["first", "US", "forth", "inter3", "final3"]

@MelikbekyanAshot
Copy link

I have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants