jsf - 提取树内置过滤器以分离输入
问题描述
我目前正在使用 Primefaces 开发一个应用程序,最近开始使用 Tree 组件。它完全提供了我需要的功能,但是在对话框中使用它时遇到了一些问题。当有很多记录时,我必须围绕这棵树<p:outputPanel>
才能滚动。在我向该树组件添加过滤之前,一切都很好。由于包围面板,此过滤器输入文本出现在树的正上方,在此面板内部,当我向下滚动时,此过滤器输入位于顶部上方。
是否有可能我在整个面板上方手动添加过滤器输入并将其连接到树,就像在 PrimeFaces 的 DataTable 组件中所做的那样?尝试过这种方式,但它不起作用。下面是我的对话框的 .xhtml。任何帮助,将不胜感激。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui" xmlns:f="http://xmlns.jcp.org/jsf/core">
<p:dialog id="manageKnownDeviceDlg" header="#{msg['ip.usb.manageKnownDlg.Title']}" height="700"
showEffect="explode" resizable="true" modal="true" appendTo="@(body)"
width="700" widgetVar="manageKnownDeviceDlg" style="text-align: right;">
<h:form id="manageKnownDialogForm" >
<p:outputPanel style="width: 100%; max-height: 600px; min-height: 600px;height: 88%;overflow: auto;display: block; border: solid 1px;">
<p:tree id="manageKnownDevicesTree" var="knownDevice" value="#{baseModel.usbDeviceDictTreeRoot}"
widgetVar="usbDeviceDictTree"
selectionMode="checkbox" selection="#{baseModel.usbDeviceDictSelected}"
filterBy="#{knownDevice}" filterMatchMode="contains" emptyMessage="#{msg['global.noData']}"
style="text-align: left; width: 98%;">
<p:treeNode>
<h:outputText value="#{knownDevice.toString()}"/>
</p:treeNode>
</p:tree>
</p:outputPanel>
<br/>
<h:panelGrid columns="1" style="position: absolute; right: 5px;">
<h:panelGrid columns="5" style="margin-top: 10px;">
<p:commandButton value="#{msg['ip.usb.manageKnownDlg.Disable']}" update="manageKnownDevicesTree"
actionListener="#{knownDevicesDlgController.unselectKnownDeviceClasses}" styleClass="vs-button"
process="manageKnownDeviceDlg"/>
<p:commandButton value="#{msg['ip.usb.manageKnownDlg.YesToAll']}" update="manageKnownDevicesTree"
actionListener="#{knownDevicesDlgController.selectAllDevices}" styleClass="vs-button"
process="manageKnownDeviceDlg"/>
<p:commandButton value="#{msg['ip.usb.manageKnownDlg.NoToAll']}" update="manageKnownDevicesTree"
actionListener="#{knownDevicesDlgController.unselectAllDevices}" styleClass="vs-button"
process="manageKnownDeviceDlg"/>
<p:commandButton value="#{msg['global.ok']}" update="usbForm:usbDeviceTable,manageKnownDialogForm"
onclick="PF('manageKnownDeviceDlg').hide();" process="manageKnownDeviceDlg" styleClass="vs-button"
actionListener="#{knownDevicesDlgController.addKnownDevice}" style="text-align: right"/>
<p:commandButton value="#{msg['global.cancel']}" update="manageKnownDeviceDlg" styleClass="vs-button"
onclick="PF('manageKnownDeviceDlg').hide();"/>
</h:panelGrid>
</h:panelGrid>
</h:form>
</p:dialog>
</ui:composition>
解决方案
推荐阅读
- git - 如何防止有人克隆我的 Heroku 应用程序存储库?
- python - 有效地获取 np.datetime64 元素列表中不同日期的数量
- javascript - 如何使用需要循环 100 万次的函数修复“超出最大调用堆栈大小”错误
- python - 如何在熊猫数据框中使用特殊字符将日期值与文本列分开?
- jquery - 我很难在 Jquery 中禁用一个函数
- python - 命令队列失败:OUT_OF_HOST_MEMORY
- java - 在数组函数中相乘
- ruby - 如何将先前循环迭代的计算值相加?
- python - 访问 Selenium“选择器”对象、Python / Scrapy 的属性/数据
- julia - 如何在有限的时间内运行代码?