ipywidgets
ipywidgets copied to clipboard
Extending jslink?
jslink is really useful for having some frontend only communication, however there are more use cases I can think of that would be useful. I wonder if some thought went already into this, if not maybe it is useful to discuss some use cases that could be implemented simply.
- bijective transformation, for instance a slider that controls the log of a value, or a linear transformation. Could be a js code snippet argument to jslink, or maybe only a property to the Link class, and a different function to set this, e.g.
jslinkf((widget1, 'value', 'Math.log(value)'), (widget2, 'value', 'Math.exp(value)'
- Regarding #1091 I can imagine this. We have a some widget, with a property children (list of widgets), and we want to set another property based on a togglebutton (or any _selector subclass). On the JS side you could use the
.index
to get the child from the list, and then assign it to a target.jslinkXXX((selector, 'index'), (some_widget, 'children'), (visible_panel_proxy, 'child'))
. I hope this example is clear. - Sometimes if something changes, you do not want to link that 'something', but a propery of that 'something'. Say if
scatter.style
changes, you want to linkscatter.style["color"]
tobar.selected_style["color"]
, e.g.jslinkYYY((scatter, 'style', 'color'), (bar, 'selected_style', 'color'))
.