2
I have a table and in this table I have the option to edit.
Clicking on the edit option opens the dialog and all fields (columns) of the current row I want to edit are filled in.
A list is loaded on selectOnMenu
but it doesn’t bring me the current line item I chose to edit.
<p:dialog id="dl-editar" widgetVar="editar" header="Editar Medicamento"
showEffect="fade" hideEffect="explode" closable="true" closeOnEscape="true"
resizable="false" maximizable="false" modal="true" appendTo="@(body)">
<p:spacer height="10px;"/>
<h:form id="form-editar">
<p:focus/>
<h:panelGrid id="panel-editar" columns="1">
<p:outputLabel value="Medicamento"/>
<p:inputText value="#{BeanMedicamento.medicamento.nome}" size="32" maxlength="80" />
<p:outputLabel value="Concentracao"/>
<p:inputText value="#{BeanMedicamento.medicamento.concentracao}" size="10" maxlength="80"/>
<p:outputLabel value="Preco" />
<p:inputText value="#{BeanMedicamento.medicamento.preco}" size="10"/>
<p:outputLabel value="Quantidade"/>
<p:inputText value="#{BeanMedicamento.medicamento.quantidade}" size="10"/>
<p:outputLabel value="Laboratorio"/>
<p:selectOneMenu value="#{BeanMedicamento.medicamento.laboratorio.id}" filter="true">
<f:selectItem itemLabel="Selecione" itemValue=""/>
<f:selectItems value="#{BeanMedicamento.listaLaboratorio}" var="lista"
itemLabel="#{lista.sigla}" itemValue="#{lista.id}" />
</p:selectOneMenu>
</h:panelGrid>
<h:panelGrid columns="3">
<p:spacer width="35px;"/>
<p:commandButton value="Sim" icon="ui-icon-check"
actionListener="#{BeanMedicamento.editar}"
oncomplete="PF('editar').hide(); tbmedicamento.clearFilters()"
update=":form-tabela:tabela :mensagem"/>
<p:commandButton value="Não" icon="ui-icon-close"
oncomplete="PF('editar').hide(); tbmedicamento.clearFilters()"
update=":form-tabela:tabela"/>
</h:panelGrid>
<p:spacer height="10px;"/>
</h:form>
</p:dialog>
Primefaces 4.0
Javax.faces 2.2.5