eric MC
eric MC

Reputation: 766

Spring Roo - Add finder to Every Row in list.jspx

I have a finder created, findUserBySupervisoID. I want to take that finder and apply it to every row in list.jspx while taking one of the items (managerID) from list.jspx as the parameter for the finder. I know I need to modify list.tagx but I'm unsure of how to pass the manager ID, which isn't its primary key, through for each row. Any advice?

Upvotes: 1

Views: 876

Answers (1)

Solubris
Solubris

Reputation: 3763

  • copy table.tagx to tableManager.tagx

this allows you to update the roo tags later on, without losing your changes

  • update list.jspx to use tableManager instead of table

  • add your custom column to tableManager.tagx, see example below:

Extra param to turn on/off custom column:

<jsp:directive.attribute name="hits" type="java.lang.Boolean" required="false" description="Include 'hits' link into table (default true)" />

Default value for extra param

<c:if test="${empty hits}">
  <c:set var="hits" value="true" />
</c:if>

Displaying the extra column

      <c:if test="${hits}">
        <td>
          <spring:url value="/hits" var="hits_form_url">
            <spring:param name="find" value="ByScraper"/>
            <spring:param name="scraper" value="${itemId}"/>
            <spring:param name="page" value="1"/>
            <spring:param name="size" value="${param.size}"/>
          </spring:url>
          <spring:url value="/resources/images/list.png" var="hits_image_url" />
          <spring:message arguments="${typeName}" code="entity_hits" var="hits_label" />
          <a href="${hits_form_url}" alt="${fn:escapeXml(hits_label)}" title="${fn:escapeXml(hits_label)}">
            <img alt="${fn:escapeXml(hits_label)}" class="image" src="${fn:escapeXml(hits_image_url)}" title="${fn:escapeXml(hits_label)}" />
          </a>
        </td>
      </c:if>

Upvotes: 1

Related Questions