Open
Description
Description
When using the selected
attribute of nodes, the selected nodes are not contained in the selectedNodeData
attribute after adding more nodes to the selection via ctrl + click
.
Steps/Code to Reproduce
import dash
import dash_cytoscape as cyto
import dash_html_components as html
from dash.dependencies import Output, Input
app = dash.Dash(__name__)
app.layout = html.Div([
cyto.Cytoscape(
elements=[
{
'data': {
'id': 1,
'label': 1
},
'selected': True
},
{
'data': {
'id': 2,
'label': 2
}
}
],
id='graph'
),
html.Pre(id='node-data')
])
@app.callback(Output('node-data', 'children'), [Input('graph', 'selectedNodeData')])
def print_selected_node_data(selected_node_data):
return str(selected_node_data)
if __name__ == "__main__":
app.run_server(port=8051, debug=True)
After opening the page, node 1
is selected by default. Ctrl + click
on node 2
.
Expected Results
Ctrl + click
on node 2
-> selectedNodeData
contains [{'id': '1', 'label': 1}, {'id': '2', 'label': 2}]
.
Actual Results
After opening the page, node 1
is selected by default. Ctrl + click
on node 2
-> selectedNodeData
contains just [{'id': '2', 'label': 2}]
.
Versions
Dash 1.8.0
Dash Core Components 1.0.2
Dash HTML Components 1.7.0
Dash Renderer 1.2.3
Dash HTML Components 0.1.1