I’ve been trying to use selectionStart and selectionEnd inside the dcc.Input() but I’m not sure how to make it work according to the documentation. This is my code so far:
app.layout = html.Div([
html.Div([
dcc.Input(
id='my_txt_input',
type='text',
debounce=True,
selectionDirection=" ",
selectionStart=" ",
selectionEnd=" ",
),
]),
html.Div(id='div_output'),
html.P(['Selection Direction:']),
html.Div(id='div_slct_Direction'),
html.P(['Selection Start:']),
html.Div(id='div_slct_Start'),
html.P(['Selection End:']),
html.Div(id='div_slct_End'),
])
@app.callback(
[Output(component_id='div_output', component_property='children'),
Output(component_id='div_slct_Direction', component_property='children'),
Output(component_id='div_slct_Start', component_property='children'),
Output(component_id='div_slct_End', component_property='children')
],
[Input(component_id='my_txt_input', component_property='value'),
Input(component_id='my_txt_input', component_property='selectionDirection'),
Input(component_id="my_txt_input", component_property='selectionStart'),
Input(component_id="my_txt_input", component_property='selectionEnd')
]
)
def update_input(txt_inserted, slct_dirct, slct_start, slct_end)
print(type(slct_start))
return(txt_inserted, slct_dirct, slct_start, slct_end)
Nothing seems to happen and I always get a None type.
What are the string options that I can use for the selectionStart and selectionEnd parameters inside dcc.Input()?
How do these parameters work?
1 post - 1 participant