You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-10
Original file line number
Diff line number
Diff line change
@@ -81,17 +81,15 @@ julia> app.layout = html_div() do
81
81
html_div(id = "my-div")
82
82
end
83
83
84
-
julia> callback!(app, callid"my-id.value => my-div.children") do input_value
84
+
julia> callback!(app, Output("my-div", "children"), Input("my-id", "value")) do input_value
85
85
"You've entered $(input_value)"
86
86
end
87
87
88
88
julia> run_server(app, "0.0.0.0", 8080)
89
89
```
90
-
91
-
* You can make your dashboard interactive by register callbacks for changes in frontend with function ``callback!(func::Function, app::Dash, id::CallbackId)``
92
-
* Inputs and outputs (and states, see below) of callback are described by struct `CallbackId` which can easily created by string macro `callid""`
93
-
*`callid""` parse string in form ``"[{state1 [,...]}] input1[,...] => output1[,...]"`` where all items is ``"<element id>.<property name>"``
94
-
* Callback functions must have the signature(states..., inputs...), and provide a return value comparable (in terms of number of elements) to the outputs being updated.
90
+
* You can make your dashboard interactive by register callbacks for changes in frontend with function ``callback!(func::Function, app::Dash, output, input, state)``
91
+
* Inputs and outputs (and states, see below) of callback can be `Input`, `Output`, `State` objects or vectors of this objects
92
+
* Callback function must have the signature(inputs..., states...), and provide a return value comparable (in terms of number of elements) to the outputs being updated.
95
93
96
94
### States and Multiple Outputs
97
95
```jldoctest
@@ -107,7 +105,7 @@ julia> app.layout = html_div() do
107
105
html_div(id = "my-div2")
108
106
end
109
107
110
-
julia> callback!(app, callid"{my-id.type} my-id.value => my-div.children, my-div2.children") do state_value, input_value
isempty(id.input) &&error("The callback method requires that one or more properly formatted inputs are passed.")
141
+
isempty(deps.output) &&error("The callback method requires that one or more properly formatted outputs are passed.")
142
+
isempty(deps.input) &&error("The callback method requires that one or more properly formatted inputs are passed.")
82
143
83
-
length(id.output) !=length(unique(id.output)) &&error("One or more callback outputs have been duplicated; please confirm that all outputs are unique.")
144
+
length(deps.output) !=length(unique(deps.output)) &&error("One or more callback outputs have been duplicated; please confirm that all outputs are unique.")
84
145
85
-
for out inid.output
86
-
ifany(x->out in x.id.output, values(app.callbacks))
146
+
for out indeps.output
147
+
ifany(x->out in x.dependencies.output, values(app.callbacks))
0 commit comments