Snippets in component are redrawing only in render() view
- medhi
- Generous Backer | 255
I have a component with more views:
public function render()
{
$this->template->setFile(__DIR__ . '/templates/admin.latte');
$this->template->render();
}
public function renderDialog()
{
$this->template->setFile(__DIR__ . '/templates/dialog.latte');
$this->template->render();
}
Also I have snippets in both templates, admin.latte
and
dialog.latte
. When I try to redraw a snippet, which is placed in
admin.latte
, it works.
But if it is placed in dialog.latte
, it is not redrawn, the
snippet is not sent in the JSON.
How to redraw a snippet in dialog.latte
?
- David Matějka
- Moderator | 6445
Hi, this is known limitation. You can wrap {control foo:dialog}
into snippetArea
and re-render this snippetArea as well (using
$this->parent->redrawControl(...)
).
But in general I do not recommend using multiple component views.
I've talked about this and some other snippet issues few years ago on Posobota (czech only)
- dsar
- Backer | 53
David Matějka wrote:
But in general I do not recommend using multiple component views.
I've talked about this and some other snippet issues few years ago on Posobota (czech only)
Why you do not recommend using multiple component views?
(Unfortunately that talk is czech only…)