nested fields

Developers
2012-01-30
2013-04-29
  • Fabiana Bugli
    Fabiana Bugli
    2012-01-30

    Hi, I need to show on the result table a column with a nested field,
    I have a foreign key object on my entity and I want to show on the table the id field of that object,
    is it possible?
    Thank you

     
  • Luca Molino
    Luca Molino
    2012-01-30

    Yes it's possible but the way to do it depends on what object you are rendering as a table.

    In Roma if you render a Collection as a table every field that has a getter will be rendered so you just need to add a getter in your object. All object return values will be rendered as string using the toString().

    Example:
    List<MyObject> table;

    public class MyObject{
        public String getFirstString(){
             return "test1";
        }
    ….
        public String getFK(){
             return fkString;
        }
    // OR
    public Object getFK(){
             // If not loaded code to load your object
             return fk;
        }
    }

     
  • Fabiana Bugli
    Fabiana Bugli
    2012-01-30

    Ok, so when I need to show a nested field I will implement the getter and setter methods,
    thank you.
    :-)