question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested dp.Select not working

See original GitHub issue

Describe the bug In the docs concerning Select, there is a note:

Select expects a list of Blocks, e.g. a Plot or Table, but also including Select or Groups themselves, but if a Python object is passed, e.g. a Dataframe, Datapane will attempt to convert it automatically.

However, I am not able to get nested selects working. Instead, the outer selection method (tab or dropdown doesn’t matter) shows, and the inner one is missing, in its place being an empty doc symbol:

image

To Reproduce Execute the following repro script:

import datapane as dp


def create_plot_selection() -> dp.Select:
    test_dict = {
        "outer1": {
            "inner11label": "inner11",
            "inner12label": "inner12"
        },
        "outer2": {
            "inner21label": "inner21",
            "inner22label": "inner22",
            "inner23label": "inner23"
        }
    }

    outer_choice_blocks = []
    for outer_choice_label, inner_choices in test_dict.items():
        inner_choice_blocks = []
        for label, test_item in inner_choices.items():
            inner_choice_blocks.append(dp.Text(test_item, label=label))

        outer_choice_blocks.append(dp.Select(blocks=inner_choice_blocks, label=outer_choice_label, type=dp.SelectType.TABS))

    return dp.Select(blocks=outer_choice_blocks, type=dp.SelectType.DROPDOWN)


report = dp.Report(blocks=["Should see more than a document icon after selecting an outer choice:", create_plot_selection()])
report.save(path='report.html')

Expected behavior When opening the generated report, I’d expect to be able to use an inner select

Desktop (please complete the following information):

  • OS: Linux Mint 20,
  • Browser: Firefox on Linux,
  • Version 84.0.1 (64-bit) on Linux, on android

Smartphone (please complete the following information):

  • Device: Redmi 7
  • OS: Android 10
  • Browser: Firefox and Chrome
  • Version: firefox 84.1.2 and chrome 87.0.4280

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Buronicommented, Jan 5, 2021

@mands Yep the FE deserialiser doesn’t allow Selects to be direct ancestors of other Selects. Should be quick to allow this though.

0reactions
mandscommented, Jan 5, 2021

@Buroni - have added a unit test on the CLI side and can successfully generate valid reports with nested Selects - I think the issue may be on the FE renderer

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in syntax for nested Select Case - sql - Stack Overflow
Quantity from ( select case when D.P> T.Open then D.P from DOP D inner join T on D.PON = T.PON )a. I am...
Read more >
Converting nested JSON structures to Pandas DataFrames
In this article, we are going to see how to convert nested JSON structures to Pandas DataFrames. JSON with multiple levels.
Read more >
PartiQL Tutorial
Creating Nested Results with SELECT VALUE Queries; Creating Nested Results with ... Let's write a simple query to verify that our PartiQL REPL...
Read more >
Nested Dynamic Panel - Axure RP 9
If you have nested dynamic panels and you close an inner one it takes you ... only seems to work in one way,...
Read more >
The Nested Dirichlet Process
Although most of these ap- plications focus on problems with exchangeable samples from one unknown distribution, there is growing interest in extending the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found