How can I change from a p: inputText to a datable in primefaces from java?

0

I have a problem, what happens is that I have some components that are going to be changed, before it was a <p:autoComplete> and when the result of that autocomplete result was stored to a datatable and now the change will be with a <p:inputText> that does the same functionality to fill that table, this is the code:

Autocomplete:

<p:autoComplete id="tripulante" 
                                                                                                                value="#{routeAssignmentBean.route.employee}"
                                                                                                                emptyMessage="No hay información con este criterio de búsqueda" 
                                                                                                                completeMethod="#{routeAssignmentBean.loadEmployeesByOrigin}"
                                                                                                                scrollHeight="250" 
                                                                                                                var="tripulante" 
                                                                                                                itemLabel="#{tripulante.ls_employee_name}" 
                                                                                                                itemValue="#{tripulante}"
                                                                                                                forceSelection="true" 
                                                                                                                converter="converterEmployeeOriginRoute"
                                                                                                                required="true" requiredMessage="¡Campo Requerido!"
                                                                                                                onkeypress="return alfanumerico(event)"
                                                                                                                style="width: 25%;"
                                                                                                                >

                                                                                                    <p:ajax event="itemSelect" listener="#{routeAssignmentBean.selectionEmployee}" update="tablas_tri" />
                                                                                                </p:autoComplete>

And this is the datatable:

<div id="table_list3">
                                <p:dataTable id="tablas_tri" 
                                             scrollable="true" 
                                             scrollWidth="100%"
                                             value="#{routeAssignmentBean.listDTEmp}"
                                             var="emp" 
                                             emptyMessage="Ningun tripulante agregado">                                
                                    <p:column headerText="Tripulate">
                                        <h:outputText value="#{emp.ls_employee_name}" />
                                    </p:column>
                                    <p:column headerText="" style="max-width: 35px">
                                        <p:commandButton icon="ui-icon-close" title="remove from cart"
                                                         accesskey="" process="@this" 
                                                         actionListener="#{routeAssignmentBean.deleteTripulante(emp)}"
                                                         update="tablas_tri" 
                                                         style="width:22px;height:22px;background-color:#FF0000;"
                                                         />
                                    </p:column>
                                </p:dataTable>
                            </div>

InputText where the functionality would go:

<p:inputText id="tripulante" 
 </p:inputText>

Java code:

  public List<EmployeeVO> loadEmployeesByOrigin(String query) {
            RouteAssignmentDAO dao = new RouteAssignmentDAOImpls();
            listEmployees = dao.getEmployeesByOrigin(origin, query);
            return listEmployees;
        }

public void selectionEmployee() {
    for (EmployeeVO item : listDTEmp) {
        if (item.getLs_employee_name().equals(route.getEmployee().getLs_employee_name())) {
            return;
        }
    }

I hope and you can help me, I am waiting for any doubt or comment, greetings and excellent afternoon.

    
asked by cratus666jose 27.09.2018 в 21:36
source

0 answers