Is there a way to prevent callback until the input `id` is loaded?

I am new to Dash Plotly.

Is there a way to prevent a callback if an Id (at the current moment) used as an INPUT to one of the callbacks?

A nonexistent object was used in an `Input` of a Dash callback. The id of this object is `some-dropdown` and the property is `value`.

Or Is there a way to register all the component id in the dash and later it can be used for rendering?

Hi @JagatBhat

Could you explain why you don’t have the id at the first loading?

I am trying to build simple interactive tables depending on the user input.

  1. User has to select one of three options (radio button)
  2. Depending on the user’s choice, the layout will be decided.
  3. Once the User clicks on the choice, all the required Input-Ids will be available as the layout will be loaded.

@JagatBhat

Well, there are different options:

  1. As the Input or Output just works with “id” name (no matters if it’s the table Id name or the Div id name) you can have 3 different Div inside the Div that will receive the table and when the callback process the dropdown option selected by the user it returns 2 empty Div and one table. Like:
    html.Div(
         html.Div(id=‘mytable1’),
         html.Div(id=‘mytable2’),
         html.Div(id=‘mytable3’),
         id = ‘my_output’
   )

   The return of the callback to my_output will be

         dash_table.DataTable(id=‘mytable1’,  etc, etc,),
         html.Div(id=‘mytable2’),
         html.Div(id=‘mytable3’),

  1. Just use only one name for the table and differentiate the table by the dropdown value:
    html.Div(
        dash_table.DataTable(id=‘mytable)
   )
     In one callback return the table according to the dropdown value selected by the user.
     In the second callback use as input the table property you need and also the dropdown value to know which specific table are you dealing with.
1 Like