Black Lives Matter. Please consider donating to Black Girls Code today.

Dynamic number of inputs, how to put callbacks for each input

Hi,

I have added one div, id-list of charts. In this i am returning n number of figures, as per multi select drop down, so if we have selected 3 in the drop down, i am plotting 3 charts below. In this what i need to do is, in each of the div’s below i have added an input set as well, using that input set i need to change the below charts.

Is there a way we can have the callbacks for dynamic inputs?

snip of the code where i am returning the charts -

      html.Button('Update', id='update-button', className='btn btn-primary'),
    ], id='settings-a-div', className='col-md-12'),
], className='row mh1'),

snip where i am adding charts in a loop:

for curr in pair:
    rng+=1
    temp = update_change_chart(dff[dff['sym'] == curr], annotation, curr, sect,rng)
    temp = dcc.Graph(id='plot_' + curr, figure=temp)
    # html_charts.append(html.Div(className = 'row'))
    html_charts.append(html.Div([dcc.Input(name='Trade Size',
                  placeholder='T Size',
                  type='text',
                  value=50,
                  id='ts_'+curr
                  ),dcc.Input(name='sect',
                                           placeholder='sect',
                                           type='text',
                                           value='client',
                                           id='cs_'+curr
                                           )],className='col-md-12'))

    html_charts.append(html.Div([temp], className='col-md-12'))
    html_charts.append(html.Div(id='settings-b-div', className='col-md-12'))

return html_charts

Hey mixy!

I know that your question was a while ago, but maybe you solved the issue somehow. If yes could you share the idea? I’m bothering with the same problem :frowning:

Best!