小编Ron*_*ald的帖子

Primefaces按Enter执行commandButton

我正在使用primefaces,我有以下问题,我有一个工具栏,其中有几个按钮和组件,如inputtext和其他形式的组件,但当我Enter在某个组件中按键时,工具栏的第一个按钮被调用,在这种情况下命令按钮"idButtomNuevo"被调用,因为它位于第一个位置.

我的代码:

almacen.xhtml

<ui:composition  
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:p="http://primefaces.org/ui" >

 <h:form id="idFormAlmacen" >
    <p:focus context="idFormAlmacen"/>
    <p:growl id="growl" showDetail="true" life="2500" for="keyAlmacen" globalOnly="true"/>
    <p:panel header="Almacen" styleClass="texto-panel"/>
    <ui:include src="/pages/logistica/almacen/toolbar_almacen.xhtml"/>
    <ui:include src="#{almacenBean.pathbodyAlmacen}" />    
 </h:form>
 <ui:include src="/pages/logistica/almacen/dialogos_almacen.xhtml" />
</ui:composition> 
Run Code Online (Sandbox Code Playgroud)

toolbar_almacen.xhtml

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:p="http://primefaces.org/ui">
    <p:toolbar>  
        <p:toolbarGroup align="left" styleClass="panelgrid-css">
            <p:commandButton id="idButtomNuevo" title="Nuevo"  icon="ui-icon-document" process="@this" value="Nuevo"
                    actionListener="#{almacenBean.limpiarAlmacen}" update="idFormAlmacen" immediate="true">
                 <p:resetInput target="idFormAlmacen"/>
            </p:commandButton>
            <p:commandButton id="idButtomGuardar" title="Guardar" icon="ui-icon-disk" action="#{almacenBean.guardarAlmacen}" 
                 disabled="#{almacenBean.au.btGuardarDisabled}" update=":idFormAlmacen" validateClient="true" value="Guardar"/>
            <p:commandButton id="idButtomEliminar" title="Eliminar" icon="ui-icon-trash" actionListener="#{almacenBean.eliminarAlmacen}"
                 disabled="#{almacenBean.au.btGuardarDisabled}" update="idFormAlmacen" process="@this" immediate="true"
                 value="Eliminar"/>
            <p:commandButton id="idButtomListar" …
Run Code Online (Sandbox Code Playgroud)

primefaces jsf-2 jsf-2.2

8
推荐指数
2
解决办法
1万
查看次数

PrimeFaces RequestContext.getCurrentInstance().update()无效

我使用的对话框架:

http://www.primefaces.org/showcase-labs/ui/dialogFrameworkData.jsf

我创建了一个文件view_test.xhtml

<html  xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui" >
<h:head>
    <title>Dialogo Prueba</title>
</h:head>
<h:body>
    <h:form id="idFormTest">
        <h:panelGrid id="idPgAdressStore" columns="2" columnClasses="col1,col2">
        <h:outputLabel for="idAdress" value="Adress: " />  
        <p:inputText id="idAdress"  label="Adresss" size="40" value="#{storeBean.au.strAdress}"/>
        <f:facet name="footer">
            <h:panelGrid width="100%" columns="2" style="text-align:center">
                <p:commandButton id="idBtSaveDir" value="Save" actionListener="#{storeBean.saveAdress}" />
                <p:commandButton id="idBtCancelDir" actionListener="#{storeBean.closeAdress}"  value="Cancel"/>
            </h:panelGrid>
        </f:facet>
        </h:panelGrid>
    </h:form>
</h:body>
Run Code Online (Sandbox Code Playgroud)

此对话框打开其他形式的"idFormStore",当我单击commandButton"idBtSaveDir"时,方法saveAdress被调用,idAdress中的值被复制到idFormStore中的其他输入文本中

public void saveAdress(ActionEvent event) {
    au.setAdressStore(au.getStrAdress());
    RequestContext.getCurrentInstance().update("idFormStore");
    RequestContext.getCurrentInstance().closeDialog("/pages/logistica/store/view_test");
}
Run Code Online (Sandbox Code Playgroud)

我正在更新表单idFormStore,但它没有更新RequestContext.getCurrentInstance().update("idFormStore")不起作用,

我还把panelgrid放在inputext中并且不更新,RequestContext.getCurrentInstance().update("idFormStore:idPanelStore")

但是我重新加载了我输入的所有页面,所以我必须把它放在RequestContext.getCurrentInstance().update中?

primefaces jsf-2

4
推荐指数
1
解决办法
1万
查看次数

Angular-数据表点击行事件

我正在使用AngularJS和angular-datatable,并且想连续处理该事件,我已经设置了控制器来侦听该事件,但是它不起作用。我的代码是:

html

<div  class="panel panel-flat">
    <div class="panel-heading">
        <h6 class="panel-title">Planilla</h6>
    </div>
    <div class="panel-heading"> 
    <table class="table datatable-basic table-hover" datatable="ng" dt-options="empleadoList.dtOptions"  dt-column-defs="empleadoList.dtColumnDefs" >
        <thead>
            <tr>
                <th style="width: 30px;">Nro.</th>  
                <th>Nombre Completo</th>
                <th class="col-md-2">DNI</th>
                <th class="col-md-2">Celular</th>
                <th class="col-md-2">Teléfono</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="empleado in empleadoList.empleados">
                <td style="width: 30px;">{{$index + 1}}</td>
                <td> <span class="text-muted"><i class="icon-user"></i>{{empleado.apellidoPaterno}} {{empleado.apellidoMaterno}} {{empleado.nombre}}</span></td>
                <td><span class="text-success-600"><span class="status-mark border-blue position-left"></span>{{empleado.dni}}</span></td>
                <td><span class="text-success-600"><i class="icon-mobile position-left"></i> {{empleado.celular}}</span></td>
                <td><h6 class="text-semibold"><i class="icon-phone position-left"></i> {{empleado.telefono}}</h6></td>
            </tr>
        </tbody>
    </table>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

controller.js

App.controller('EmpleadoListController', function($scope,$resource,EmpleadoService,DTOptionsBuilder,DTColumnDefBuilder) {

$scope.dtOptions = DTOptionsBuilder.newOptions()
    .withDisplayLength(10)
    .withOption('bLengthChange', …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angular-datatables

1
推荐指数
1
解决办法
6201
查看次数