简体   繁体   English

p:工具提示,用于在PrimeFaces 5的列中为每一行重复的图标

[英]p:tooltip for an icon that repeats for each row inside a column in PrimeFaces 5

Assuming that I have a table with rows and columns (as expected) and one of the columns holds an icon for a trash where the <p:tooltip> should be "Delete" and another column has an icon of a pen where the <p:tooltip> should be "Edit". 假设我有一个包含行和列的表(如预期的那样),并且其中一列包含一个垃圾桶的图标,其中<p:tooltip>应该为“删除”,另一列具有一个笔图标,其中<p:tooltip>应该为“编辑”。

How should I do to make the tooltip to be displayed for each row? 如何使每行显示工具提示?

<p:dataTable var="usuario" value="#{panelView.usuarios}"
    rendered="#{not empty panelView.usuarios}" paginator="true"
    sortBy="#{usuario.usuario}" rows="10">
    <p:column headerText="Nome">
        <h:outputText value="#{usuario.usuario}" />
    </p:column>

    <p:column headerText="Grupo">
        <h:outputText value="#{usuario.grupo}" />
    </p:column>

    <p:column headerText="Role">
        <h:outputText value="#{usuario.role}" />
    </p:column>
    <p:column headerText="Sistema">
        <h:outputText value="#{usuario.sistema}" />
    </p:column>

    <p:column headerText="Subsistema">
        <h:outputText value="#{usuario.subsistema}" />
    </p:column>
    <p:column>
        <h:commandLink action="...">
            <h:graphicImage value="/img/bw_edit.gif" height="16px" width="16px">
            <p:tooltip id="toolTipFade" value="Editar" />
            </h:graphicImage>
        </h:commandLink>
    </p:column>
    <p:column>
        <h:commandLink action="...">
            <h:graphicImage value="/img/bw_trash.gif" height="16px" width="16px">
            </h:graphicImage>
        </h:commandLink>
    </p:column>
</p:dataTable>

Try this: 尝试这个:

<p:column>
    <h:commandLink action="...">
        <h:graphicImage value="/img/bw_edit.gif"
                        height="16px"
                        width="16px"
                        title="Editar"/>
    </h:commandLink>
</p:column>

This works for me. 这对我有用。

Regards. 问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM