Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Primefaces 搜索后,编辑项取上一个值,有什么问题?_Primefaces_Jsf 2 - Fatal编程技术网

Primefaces 搜索后,编辑项取上一个值,有什么问题?

Primefaces 搜索后,编辑项取上一个值,有什么问题?,primefaces,jsf-2,Primefaces,Jsf 2,我做了一个dataTableFilter来创建编辑和删除带有搜索的项目。在我执行“键入时搜索”之前,一切正常,但当我在执行“键入时搜索”后添加项目时,该项目将添加到数据库和视图中,但如果我再次单击“编辑”,它将显示其下方的值,当我按“取消”时,添加的值将消失!同样,如果我在您键入时搜索,则新项目开始出现 我已经为此奋斗了很长时间,JSF primefaces中有限制吗 <p:dataTable id="itemTable" var="row" val

我做了一个dataTableFilter来创建编辑和删除带有搜索的项目。在我执行“键入时搜索”之前,一切正常,但当我在执行“键入时搜索”后添加项目时,该项目将添加到数据库和视图中,但如果我再次单击“编辑”,它将显示其下方的值,当我按“取消”时,添加的值将消失!同样,如果我在您键入时搜索,则新项目开始出现

我已经为此奋斗了很长时间,JSF primefaces中有限制吗

    <p:dataTable id="itemTable" var="row"
                value="#{itemBean.allitems}"
                emptyMessage=" No itemue found" styleClass="borderless"
                paginator="true" rows="10" paginatorPosition="bottom"
                style="font-family:'Lato';font-size:12px;border:1px solid #d7d9b2"
                widgetVar="cataTable"
                filteredValue="#{itemBean.filtereditems}">
                <f:facet name="header">
                    <div class="row">
                        <p:outputPanel>
                            <div class="col-lg-9"
                                style="margin-top: 6px; text-align: right; font-weight: bold">
                                <h:outputText value="Search all fields : " />
                            </div>
                            <div class="col-lg-3">
                                <p:inputText id="globalFilter"
                                    onkeypress="if (event.keyCode == 13) {return false; }"
                                    onkeyup="PF('cataTable').filter()"
                                    styleClass="form-control txtFieldInput"
                                    placeholder="Enter keyword" />
                            </div>
                        </p:outputPanel>
                    </div>
                </f:facet>
                <p:column headerText="itemue Name" filterBy="#{row.name}"
                    filterStyle="display:none" sortBy="name" filterMatchMode="contains"
                    style="width:8%;text-align: center">
                    <h:outputText value="#{row.name}" />
                </p:column>
                <p:column headerText="No.of subitems"
                    style="width:8%;text-align: center">
                    <h:outputText value="#{row.totalsubitems}" />
                </p:column>
                <p:column headerText="Description"
                    style="width:8%;text-align: center">
                    <h:outputText value="#{row.description}" />
                </p:column>
                <p:column headerText="Date(MM/DD/YYYY)"
                    style="width:8%;text-align: center">
                    <h:outputText value="#{row.toDate}">
                    </h:outputText>
                </p:column>
                <p:column headerText="Base URL" style="width:8%;text-align: center">
                    <h:outputText value="#{row.itemurl}" />
                </p:column>

                <p:column style="width:5%;text-align: center">
                    <f:facet name="header">Action</f:facet>
                    <p:commandButton ajax="true" icon="ui-icon-pencil" title="Edit"
                        update=":itemForm:updateitemData"  
                        oncomplete="PF('updateitem').show()">
                        <f:setPropertyActionListener value="#{row}"
                            target="#{itemBean.selecteditem}" />
                    </p:commandButton>
                    <p:commandButton ajax="true" icon="ui-icon-trash" title="Deactive"
                        style="background-color:green" rendered="#{row.isActive == 'Yes'}"
                        actionListener="#{itemBean.deleteitem(row)}"
                        oncomplete="PF('itemDelete').show()">
                    </p:commandButton>

                    <p:commandButton ajax="true" icon="ui-icon-trash" title="Active"
                        style="background-color:red" rendered="#{row.isActive == 'No'}"
                        actionListener="#{itemBean.activateitem(row)}"
                        oncomplete="PF('activateitem').show()">
                    </p:commandButton>

                </p:column>

            </p:dataTable>

行动

1:,2:请提供版本信息,3:毫不延迟地对每个密钥进行筛选不是最佳做法。primefaces 6.0,JSF 2.2.13Hi,感谢您回答三分之一的问题。。。建议(正如您应该已经做过的那样,您应该尝试6.1、6.2和7.0,并且请尝试3搜索筛选器中的任何数据,而不是清除筛选器,现在我们尝试编辑拾取上一条记录而不是新添加的记录的行。感谢您添加注释,并从第一条注释中解决1和3