Creating a drop-down row in displaytag

Posted by bphilipnyc on Stack Overflow See other posts from Stack Overflow or by bphilipnyc
Published on 2010-04-24T19:10:16Z Indexed on 2010/04/24 19:13 UTC
Read the original article Hit count: 676

Filed under:
|
|
|

I am currently using displaytag for tabular data, but would like to create a "kayak.com-like" interface where when a user clicks a row, the user is shown more details about the particular row without a page refresh.

I tried using a decorator to return javascript that would do this. The javascript is executed, but it is only reflected in the column where it was rendered. I am looking to create a new row with the data.

e.g.:

public class CustomDecorator extends TableDecorator {
   public String getDetailsRow() {
      MyObject object = (MyObject)this.getCurrentRowObject();
      return "<a onClick=\"myjsfunction(object.getId()); return true\">Details</a>";
   }
}

...and in the JSP I would have a detailsRow property nested between the display:table tags:

<display:column property="detailsRow" sortable="false" />

Any tips on how to create a new row? The solution may be in the way that the javascript is written - I'm not an expert with Javascript, so any tips would be appreciated. Is there a better way to do this with displaytag? I don't know of any explicit integration that displaytag has with javascript (like an "onclick" parameter) either.

This is my first question on stackoverflow, btw - so please let me know whether you need more detail.

© Stack Overflow or respective owner

Related posts about displaytag

Related posts about java