Announcement Announcement Module
Collapse
No announcement yet.
Roo generated pages showing full row rather than Foreign key Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo generated pages showing full row rather than Foreign key

    The pages generated by ROO for the foreign key show the corresponding record instead of the foreign key.

    I want to show only the foreign key rather than full record.

    Is there a option to do that while generating.

    I don't want to mess with the generation but rather want to control it via some configuration or option while running.


    Let me know if any of you have faced this issue.

    I have not able to trace the answer trying to google or in forum.

    Regards

  • #2
    As far as I know there isn't any configuration option.

    However you can achieve that by extending default converters by adding new Converter by id.

    In general case you need to create new Converter and update toString() method.
    For example if you want to return title not the default primary key ID of field with JSF generated views:

    Code:
    public String PopupConverterTitle.getAsString(FacesContext context,
    			UIComponent component, Object value) {
    
    		return value instanceof Popup && ((Popup) value).getTitle() != null ?
    				((Popup) value).getTitle() : "";
    	}
    Then I use my custom converter in the places where I need to have different value that spring-roo value.

    With web mvc there are also this type of convertors and I suppose they should exist in GWT generated views too.

    Hope this helps.

    Comment


    • #3
      Thank you for the reply. This was quite easy to do and there is change in only one file thus can be easy to maintain too.

      All other lists too was easily manageable.

      I realised there is another question which makes my question as duplicate
      http://forum.springsource.org/showth...entire-content

      I will add comments to point to this location.

      Comment


      • #4
        Thank you. Perfect answer.

        Thank you for the reply. This was quite easy to do and there is change in only one file thus can be easy to maintain too.

        All other lists too was easily manageable.

        I realised there is another question which makes my question as duplicate
        http://forum.springsource.org/showth...entire-content

        I will add comments to point to this location.

        Comment

        Working...
        X