• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

DisplayTag & Checkbox

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Does anybody know how to add checkboxes to a table column rendered by displaytag 0.8.5 ? how to make checkboxes to remain being checked after another column is sorted? If yes, please help!!

Thanks in advance.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Extend display tags column Decorator and use the same decorator class in the display tag column. In your class you can display the check boxes.

Your Jsp looks like
<display:table name="list" decorator="com.test.SearchResultsDecorator"> <display:column property="checkBox" headerStyleClass="columnhead lcell" title=""/>
</display:table>

Your Decorator Class Code looks like

public String getCheckBox(){
Content obj = (Content) this.getCurrentRowObject();
long checkboxValue=obj.getContentId();
String checkboxDisplay = obj.getContentName();

/* Any Such condition can be added here .....
if(checkInSelectedList(checkboxValue))
return disabledCheckBox(checkboxValue,checkboxDisplay).toString();
else
*/
return checkbox(checkboxValue,checkboxDisplay).toString();
}

private StringBuffer checkbox(long checkboxValue,String checkboxDisplay) {
return new StringBuffer().append("<input type='checkbox' name='"checkbox_name" value='").append(checkboxValue).append("'>");
}

Regards
Gopi
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic