DisplayTag
  1. DisplayTag
  2. DISPL-200

Can't use nested properties in TableDecorator

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0
    • Component/s: Decorators
    • Labels:
      None

      Description

      I have a table that uses nested properties in the columns:

      <display:table name="customers" decorator="CustomerTableDecorator" id="customer">
        <display:column property="address.postalCode"/>
      </display:table>

      I want to decorate the column with a TableDecorator, but I cannot specify that the property "postalCode" should be decorated, as the hasGetterFor method of Decorator considers only the "address" part of the property name. Is there a way to do this or would this be an enhancement?

        Activity

        Hide
        fabrizio giustina added a comment -
        It should work, if you add to your table decorator a getAddress() method. The getPostalCode() method will be called on the object returned by the decorator. Better, you could add a getAddressPostalCode() (or similar) methods to your table decorator directly.
        Show
        fabrizio giustina added a comment - It should work, if you add to your table decorator a getAddress() method. The getPostalCode() method will be called on the object returned by the decorator. Better, you could add a getAddressPostalCode() (or similar) methods to your table decorator directly.
        Hide
        Wayne Gentile added a comment -
        Can you explain the second option in more detail?
        Show
        Wayne Gentile added a comment - Can you explain the second option in more detail?
        Hide
        fabrizio giustina added a comment -
        testcase added for nested properties.
        using <display:column property="address.postalCode"/> will cause the getAddress() method to be called on your decorator, and getPostalCode() will be called on the returned object, as expected.

        If you want to change/decorate the value returned by getPostalCode() you could add a new method to the table decorator, for example:

        public String getAddressPostalCode() {
            return (Something)getCurrentRowObject()).getAddress().getPostalCode() + " - decoration";
        }
        Show
        fabrizio giustina added a comment - testcase added for nested properties. using <display:column property="address.postalCode"/> will cause the getAddress() method to be called on your decorator, and getPostalCode() will be called on the returned object, as expected. If you want to change/decorate the value returned by getPostalCode() you could add a new method to the table decorator, for example: public String getAddressPostalCode() {     return (Something)getCurrentRowObject()).getAddress().getPostalCode() + " - decoration"; }

          People

          • Reporter:
            Wayne Gentile
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: