Hello I want to update two partials when a select change it's values. However I'm not being able to update my component's partials. When I call my partials on update the way the documentations teaches detalhes:'#agendaSelecionada' it returns an alert "the partial detalhes does not exists", and when I try to call as '_ SELF _::detalhes':'#agendaSelecionada' it returns "invalid partial name" (I've tryed several combinations of ", ~ and { on this line)
Can someone please help me on this?
This is my select and the partials with the default values
<div id='agendaSelecionada'>
{% partial __SELF__ ~ '::detalhes' agendaSelecionada=__SELF__.agendaSelecionada %}
</div>
<div class="row" id='agendaSelect'>
Local:
<select name="id_agenda" id="changeAgenda">
{% for agenda in __SELF__.minhasAgendas %}
<option value="{{ agenda.id }}">{{ agenda.titulo }} - {{ agenda.sede }}</option>
{% endfor %}
</select>
</div>
<div class='row' id="marcacao">
{% partial __SELF__ ~ '::marcacao'
agendaSelecionada = __SELF__.agendaSelecionada
ordemSemana = __SELF__.ordemSemana
inicioDom = __SELF__.inicioDom
atual = __SELF__.datas.atual
prox = __SELF__.datas.prox
%}
</div>
I call the handler using javascript
$('#changeAgenda').change(function(){
$.request('onChangeAgenda',{
data:{ id_agenda:$(this).val() },
update:{
detalhes:'#agendaSelecionada',
marcacao:'#marcacao'
}
});
});
And this is the event handler
public function onChangeAgenda(){
$id_agenda = input('id_agenda');
$agendaSelecionada = minhasAgendas::find($id_agenda);
$this->page['agendaSelecionada'] = $agendaSelecionada;
}
Last updated