我们有一个PrimeFaces
<h:form id="content-form">
...
<p:dataTable id="fixed-data"
widgetVar="resultTable"
value="#{resultManager.dataModel}"
filteredValue="#{resultManager.filteredEntities}"
var="result"
rowKey="#{result.id}"
selectionMode="multiple"
selection="#{resultManager.selectedEntities}"
paginator="true"
paginatorPosition="bottom"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rows="#{resultManager.selectedRowsPerPage}"
scrollable="true"
scrollHeight="200"
rowsPerPageTemplate="25,50,100,200"
resizableColumns="true"
emptyMessage="#{msg['common.action.search.noResultsMessage']}">
<p:ajax event="rowSelect" ... />
<p:ajax event="rowUnselect" ... />
<p:ajax event="sort" ... />
<f:facet name="header">
<h:panelGroup id="header-facet-panel"
layout="block">
<p:inputText id="filterInput"
widgetVar="resultTableFilterInput"
onkeypress="if (event.keyCode == 13) { filter(); return false; }" />
<p:commandButton id="search-btn"
icon="ui-icon bx-icon-search"
... />
</h:panelGroup>
</f:facet>
<p:column ... />
<p:column ... />
.
.
.
它呈现为:
正如你所看到的,我过滤了詹姆斯。因此,仅显示具有该值的行。
如果您看一下左下方,还有一个树状结构,用户可以单击它,这样您就只能看到那些在节点过滤标准之后的内容(右边的数据表会被更新)。
我们现在有两种可能性:
调用<code>dataTable.filter()
删除
调用< code > datatable . filter();
工作,不幸的是,管理层决定重置/删除输入字段
<p:inputText id="filterInput"
widgetVar="resultTableFilterInput"
onkeypress="if (event.keyCode == 13) { filter(); return false; }" />
它没有JSF
value=“…”
属性。
这是
<p:tree id="tree"
widgetVar="explorerTree"
value="#{resultManagerExplorer.rootNode}"
var="criterion"
selectionMode="single"
selection="#{resultManagerExplorer.selectedNode}">
<p:ajax event="select"
update=":content-form:fixed-data :content-form:result-sub-panel :content-form:growl"
onstart="$( 'content-form:fixed-data:filterInput' ).attr( 'value', '' ); resultTableFilterInput.value = '';"
oncomplete="resultTable.getPaginator().setPage(0); $( 'content-form:fixed-data:filterInput' ).attr( 'value', '' ); resultTableFilterInput.value = '';" />
然而,这对
没有任何作用
<input aria-readonly="false"
aria-disabled="false"
role="textbox"
id="content-form:fixed-data:filterInput"
name="content-form:fixed-data:filterInput"
value="James"
size="70"
onkeypress="if (event.keyCode == 13) { filter(); return false; }"
class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all"
type="text">
(以上是 Firefox 调试工具在树节点点击后输出的 HTML)
问题:
出了什么问题以及如何使其工作(无需为输入添加 JSF 值,例如
注意,有一个对(正确的)datatable组件的更新,DOM ID < code >:content-form:fixed-data
。
你忘了用#
开始你的jQuery选择器字符串:
$('#content-form:fixed-data:filterInput')
此外,您可能需要转义冒号:
$('#content-form\\:fixed-data\\:filterInput')
检查您是否真的找到了输入:
console.log($('#content-form\\:fixed-data\\:filterInput'));
我的xhtml中有下一个结构 方法searchAnimals()可以,它返回动物项,但dataTable不刷新,但在java代码(managedBean)中,ArrayList包含这些项。我能做什么?谢谢编辑:我正确地使用了de h:和p:后缀(我想是的),代码是完整代码的一部分,但它是无法正确工作的片段。在第一个面板中,我有一个过滤器控件(按类别、按日期等),命令按钮的功能是调用一个在数据库上执
在我的应用程序中,我有一个PF布局,在西部有一个树节点,在中部有一个内容部分,我想在其中使用ajax技术动态加载不同的页面 为了获得它,这个内容部分包含一个ui:include
我有一个datatable,其中包含删除行的按钮,我想在之后刷新该表。刷新工作很好,除了一个案例,当我删除最后一个项目。我相信这是因为属性,它在ajax更新时表现不佳。它都在一个复合组件中,datatable是有条件呈现的,看起来都是这样的: 除了我从列表中移除最后一个项目(并希望表消失)的情况外,这工作得很好。通过ajax显示表不是问题,因为我添加的项目也没有提交,并且表在添加第一个项目后正确显
我有下一个代码: 我还有一些按钮,可以从表中删除元素并对其进行更新。但是我如何更新这个表呢?哪些参数应该在更新中?我尝试了更新=“:tableForm”和更新=“:tableTabView:tableForm”和更新=“:tableTabView”,但没有得到结果。我哪里错了?
问题内容: 这是我的桌子的外观: 以及简化的代码: 该是一个字符串和两个整数,只有getter和setter。在计算第二整数从第一给定的行,也总让所有行。 因此,当我输入其中一个输入然后进行聚焦时,将调用侦听器并完成计算,但是在屏幕上,第三列中的值发生了变化,但总数固执地保持为零。我相当确定这与PrimeFaces关联,该行将行索引附加到每个输入和输出的生成ID中,但是我不知道如何在页脚中找到输出
我有两个类:停车场和汽车。公园有一个ID和一个汽车列表。我想在数据表中显示带有标签的停车场和汽车列表。问题是我无法在数据表中找到汽车的车牌号。当我尝试在Netbean中自动完成时,它会显示可能的公园字段(公园ID和汽车列表)。为什么?有什么想法如何修复它吗?
我有一个使用rowedit的p:datatable,可以正常工作,但是当您删除一个条目时,datatable没有更新。 xhtml