Announcement Announcement Module
Collapse
No announcement yet.
How to create a link for a column in list.jspx? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create a link for a column in list.jspx?

    Hi,

    I have a table with 2 columns: a report name and the report file to execute. I want to change the report name column (first column) so it becomes an hyperlink that has as part of its URL the 2nd column value, but I have not been able to make it work with the table:column tag. Well, I have not even been able to setup a static hyperlink...so yes, I have no idea how to customize the column tag.

    Code:
        <page:list id="pl_com_swroot_info3pl_model_Report" items="${reports}" z="YqjlCSimn/77CtvQ5OaovaAGMvU=">
            <table:table data="${reports}" id="l_com_swroot_info3pl_model_Report" path="/reports" z="NrbS9wlfgjT4sPYdJ5hXfz87rM8=">
                <table:column id="c_com_swroot_info3pl_model_Report_name" <table:column id="c_com_swroot_info3pl_model_Report_name" property="<a href="http://localhost:8080/reports/" + ReferenceTo_reportFileValue(3rd column)>name</a>" maxLength="35" z="user-managed"/>            <table:column id="c_com_swroot_info3pl_model_Report_description" property="description" z="Ig8xj9JX2eTEIOKqH9P08gNTdYI="/>
                <table:column id="c_com_swroot_info3pl_model_Report_reportFile" property="reportFile" z="/5rfs85yXk+c2tZH1hv/PtiBIzk="/>
            </table:table>
        </page:list>
    Thanks for any suggestion.

  • #2
    1. Update column.tagx to include a new property say "hyperlink"
    <jsp:directive.attribute name="hyperlink" type="java.lang.Boolean" required="false" rtexprvalue="true" description="Include 'hyper link' to view page" />

    2. Update column.tagx to populate the value in request
    <c:if test="${hyperlink}">
    <c:set var="columnHyperlinks" value="true" scope="request"/>
    </c:if>
    3. Update table.tagx to use this value

    <c:set var="columnHyperlinks" scope="request" />

    <c:set var="hyperlinks" value="${fn:split(columnHyperlinks, ',')}" scope="request" />

    <c:set var="columnHyperlink" value="${hyperlinks[num.count-1]}" />

    <c:otherwise>
    <c:set var="itemId"><spring:eval expression="item[typeIdFieldName]"/></c:set>
    <spring:url value="${path}/${itemId}" var="show_form_url" />
    <spring:message arguments="${typeName}" code="entity_show" var="show_label" htmlEscape="false" />
    <c:if test="${columnHyperlink}">
    <a href="${fn:escapeXml(show_form_url)}" alt="${fn:escapeXml(show_label)}" title="${fn:escapeXml(show_label)}">
    <spring:eval expression="item[column]" var="colTxt"/>
    <c:out value="${fn:substring(colTxt, 0, columnMaxLength)}" />
    </a>
    </c:if>
    <c:if test="${!columnHyperlink}">
    <spring:eval expression="item[column]" var="colTxt"/>
    </c:if>
    </c:otherwise>
    </c:choose>
    <c:choose>
    <c:when test="${columnMaxLength lt 0}">
    <c:if test="${!columnHyperlink}">
    <c:out value="${colTxt}" />
    </c:if>
    </c:when>
    <c:otherwise>
    <c:if test="${!columnHyperlink}">
    <c:out value="${fn:substring(colTxt, 0, columnMaxLength)}" />
    </c:if>
    </c:otherwise>
    </c:choose>

    4. Use the hyperlink property in list.jspx to make the column hyperlink.

    Comment


    • #3
      Hi,

      Thanks for the example.

      Can we add property Sortable to make the Column Sortable in Ascending/Descending Order.

      I tried Sortable column using Display tag library, but I need to implement it using existing <table:column>.

      Can you give an idea or example for this.

      Thanks & Regards,
      Rohit

      Comment

      Working...
      X