ReactiveHTML does not rerender loop in _template #3059
Open
Description
Current Panel master branch (latest release is 0.12.6).
Motivated by the discussion https://discourse.holoviz.org/t/sortable-widget/2877/15?u=marc
It seems the ReactiveHTML
does not rerender the _template
when using parameter in loop. I guess its not a bug. It's the way the feature works by jinja templating. So maybe this is a feature request.
We expect and need the text
section to update when the value of the parameter rows
changes. It does not.
loop_not_working.mp4
import param
import panel as pn
pn.extension(js_files={'sortablelist': "https://raw.githack.com/SortableJS/Sortable/master/Sortable.js"})
class Sortable(pn.reactive.ReactiveHTML):
rows = param.List(default=[0,1,2,3,4,5])
_template = """
<div id="simpleList" class="list-group" style="font-size:48px">
{% for row in rows %}
<div class="list-group-item">${row}</div>
{% endfor %}
</div>
"""
sortable = Sortable(rows=["Panel", "New", "Year", "Happy", "Friends", ])
update_list = pn.widgets.Button(name="Update")
@pn.depends(value=update_list, watch=True)
def update(value):
sortable.rows=["Some", "New", "Values"]
pn.Column(
update_list, sortable, sortable.param.rows
).servable()
Metadata
Assignees
Labels
No labels