小编Víc*_*nte的帖子

Primefaces datatable roweditor:只允许一行编辑

我正在使用JSF 2.1.6和Primefaces 3.4.1,我有一个问题.

我有一个带行编辑器的可编辑数据表.您可以单击每行的铅笔按钮,该行将是可编辑的.但默认情况下,可以单击许多铅笔按钮,因此可以编辑许多行.

但我想在编辑模式中只有一行.

这是我的代码示例:

<p:dataTable value="rows" var="row" editable="true" 
 id="myTable" widgetVar="myTableVar" styleClass="myTableStyle">

    <p:ajax event="rowEdit" listener="#{myBean.onUpdateRow}" />
    <p:ajax event="rowEditCancel" />

    <p:columnGroup type="header">
        <p:column headerText="Name" />
        <p:column headerText="Age" />
        ...
        <p:column headerText="Edit" />
    </p:columnGroup>

    <p:column>
        <p:cellEditor>
        <f:facet name="output">
                <h:outputText value="#{row.name}" />
            </f:facet>
            <f:facet name="output">
                 <h:inputText value="#{row.name}" /> 
            </f:facet>
        </p:cellEditor>
    </p:column>

    <p:column>
        <p:cellEditor>
        <f:facet name="output">
                <h:outputText value="#{row.age}" />
            </f:facet>
            <f:facet name="output">
                 <h:inputText value="#{row.age}" /> 
            </f:facet>
        </p:cellEditor>
    </p:column>

    ...

    <p:column>
        <p:commandLink update="myTable">
            <p:rowEditor />
        </p:commandLink>
    </p:column>

</p:dataTable>

<p:commandButton icon="ui-icon-plus" action="#{myBean.addNewRow}" update="myTable"
 oncomplete="$('.myTableStyle tbody.ui-datatable-data …
Run Code Online (Sandbox Code Playgroud)

jquery jsf primefaces

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

如何在不验证所有必需输入的情况下调用命令按钮?

我正在尝试从index.xhtml重定向到registerFirstTime.xhtml.

index.xhtml页面中的代码是:

<h:form id="content" style="margin-top: 1em;">
    <p:panel id="panel" header="LOGIN">
        <p:messages id="msgs" globalOnly="true"/>
        <h:panelGrid columns="3">
            <h:outputLabel value="e-mail" />
            <p:inputText id="name" required="true" value="#{UserBean.email}"
                requiredMessage="Required: e-mail" display="icon">
            </p:inputText>
            <p:message id="msgName" for="name"/>
            <h:outputLabel value="Password" />
            <p:password id="password" required="true" value="#{UserBean.password}"
                requiredMessage="Required: Password" display="icon" feedback="false">
            </p:password>
            <p:message id="msgPassword" for="password"/>
        </h:panelGrid>
        <h:panelGrid columns="2">
            <p:commandButton value="Login" actionListener="#{UserBean.validate}" update="msgNombre, msgPassword, msgs"/>
            <h:commandButton value="Register for the first time" action="register"/>
        </h:panelGrid>
    </p:panel>
</h:form>
Run Code Online (Sandbox Code Playgroud)

而faces-config.xml中的重定向内容是:

<navigation-rule>
    <from-view-id>index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>register</from-outcome>
        <to-view-id>registerFirstTime.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>
Run Code Online (Sandbox Code Playgroud)

在填写输入名称和密码之前,您无法进行重定向.如何在不考虑必填字段的情况下进行记录重定向?谢谢!=)

jsf redirect required-field primefaces

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

标签 统计

jsf ×2

primefaces ×2

jquery ×1

redirect ×1

required-field ×1