Rob*_*ert 3 datatable jsf tooltip primefaces
在基于JSF 2.1和Primefaces 6.0的应用程序中,我试图将工具提示添加到数据表的标题中。
在我当前的解决方案中,仅当将鼠标精确指向文本标题(“ Projekttyp”)时,才会显示工具提示。每当鼠标指针位于列标题中时,我都需要显示工具提示。不幸的是,无法为构面标头分配ID。
我了解此处描述的全局工具提示Primefaces Showcase工具提示只能在更高版本的JSF(JSF 2.2)中使用。
这是我的代码:
<p:column sortBy="#{d.auftraggeber.typ}" filterBy="#{d.auftraggeber.typ}" field="auftraggeber.typ"
filterFunction="#{filterController.filterByString}" filterable="true" sortable="true"
width="6%" styleClass="#{Constants.STRING_COL_STYLE_CLASS}">
<f:facet name="filter">
<p:inputText onkeyup="clearTimeout(window.customFilterDelay);window.customFilterDelay=setTimeout(function() {PrimeFaces.getWidgetById('#{component.parent.parent.clientId}').filter();},1500)"
value="#{sucheForm.filter.typFilter}"
tabindex="1"
styleClass="input-filter #{Constants.NO_DIRTY_CHECK_STYLE_CLASS}">
<p:ajax event="keyup" update="@(.updateableFromTableFilter)" delay="1500" />
</p:inputText>
</f:facet>
<f:facet name="header">
<h:outputText id="typColumntitle" title="Projekttyp" value="Projekttyp"/>
<p:tooltip id="typTooltip"
for="typColumntitle"
rendered="true"
myPosition="left bottom" atPosition="right bottom"
hideDelay="500">
<p:scrollPanel style="width: 300px;height:200px">
<p:dataTable id="projektTypTable" var="typ" value="#{projekttypListProducer.typAndDescList}">
<p:column headerText="Projekttyp" width="30%">
<h:outputText value="#{typ.inhalt}"/>
</p:column>
<p:column headerText="Bemerkung" width="70%">
<h:outputText value="#{typ.bemerkung}"/>
</p:column>
</p:dataTable>
</p:scrollPanel>
</p:tooltip>
</f:facet>
<h:outputText value="#{d.auftraggeber.typ}"/>
</p:column>
Run Code Online (Sandbox Code Playgroud)
小智 5
f:facet像上面那样添加标签,它将正常工作(我的意思是将显示工具提示值);如果您将鼠标悬停在列标题内的任何位置。
甚至在列标题中的文本之外。
<p:column id= "keyColumnId">
<f:facet name="header">
<h:outputText value="YOUR COLUMN HEADER" />
<p:tooltip value="TOOLTIP VALUE TO SHOW" for="keyColumnId" />
</f:facet>
</p:column>
Run Code Online (Sandbox Code Playgroud)