1
I am in need of a help with the Primefaces, I need in this event below that is already halfway forwarded an example that I took from the Primefaces itself more that later I will adapt to what I want, good is an editable grid already working, then you fill in the matricula and will call a method, in this method I will search the information, and fill in two more Datatable fields respectively, my question is, how do I pick up this line that I’m editing and shoot with the Blur event by passing the plate I want to search, and then make it update that same line with these two new fields filled. I fell halfway through on a project at the company, and I’ve never worked with Primefaces. So, briefly, what I need is for the Blur package to work as long as it’s up and running, but I don’t know if it’s the best way and with that I’ll have to take this plate I typed and get it from there in Java so I can do the Employee search and get two pieces of information and fill in the Name and Shift in the code below.
<h:form id="form">
<p:growl id="msgs" showDetail="true"/>
<p:dataTable id="cars1" widgetVar="cars1" var="car" value="#{dtAddRowView.cars1}" editable="true" style="margin-bottom:20px">
<f:facet name="header">
Funcionários
</f:facet>
<p:ajax event="rowEdit" listener="#{dtAddRowView.onRowEdit}" update=":form:msgs" />
<p:ajax event="rowEditCancel" listener="#{dtAddRowView.onRowCancel}" update=":form:msgs" />
<p:column headerText="Matricula">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.id}" /></f:facet>
<f:facet name="input">
<p:inputText value="#{car.id}" style="width:100%" label="Matricula">
<p:ajax event="blur" listener="#{dtAddRowView.onRowSelect}" update="@form"/>
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Nome">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.year}" /></f:facet>
<f:facet name="input"><p:inputText value="#{car.year}" style="width:100%" label="Year" disabled="true"/></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Turno">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{car.brand}" /></f:facet>
<f:facet name="input"><p:inputText value="#{car.brand}" style="width:100%" label="Year" disabled="true"/></f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Transporte">
<p:cellEditor>
<f:facet name="output"><h:selectBooleanCheckbox value="#{car.soldState}" /></f:facet>
<f:facet name="input"><p:selectBooleanCheckbox value="#{car.soldState}" style="width:100%" label="Year"/></f:facet>
</p:cellEditor>
</p:column>
<p:column style="width:32px">
<p:rowEditor />
</p:column>
</p:dataTable>
<div class="ui-g">
<div class="ui-g-12">
<p:commandButton value="Novo Registro" styleClass="ui-priority-primary" process="@this" update=":form:msgs"
actionListener="#{dtAddRowView.onAddNew()}" oncomplete="PF('cars1').addRow();"/>
</div>
</div>
</h:form>
Please enter the dtAddRowView.onRowSelect code. I believe it is this way: https://stackoverflow.com/questions/16989728/primefaces-inputtext-desnt-work-with-ajax-event
– Marcus Martins