I want to make a colspan
in a display:column so I tried to do it as follows:
<display:column style="width=50% colspan=2 " title="${textResources['Exam.endDate']}">
but it doesn't work it seems that this property is not allowed in a display:column so how to do that?
To add a colspan to the display column you have to create a Table Decorator extends the TableDecorator class, override the method init, in this method you need to get the header for your cell and add the colspan attribute.
package org.hannibal.utils.view.decorators;
import java.util.List;
import javax.servlet.jsp.PageContext;
import org.displaytag.decorator.TableDecorator;
import org.displaytag.model.HeaderCell;
import org.displaytag.model.TableModel;
import org.displaytag.util.HtmlAttributeMap;
public class ColspanTableDecorator extends TableDecorator {
@Override
public void init(PageContext pageContext, Object decorated,
TableModel tableModel) {
super.init(pageContext, decorated, tableModel);
List headersList = tableModel.getHeaderCellList();
HeaderCell myHeader = (HeaderCell)headersList.get(0);
HtmlAttributeMap map = myHeader.getHeaderAttributes();
map.put("colSpan", "2");
}
}
And in the jsp I use it so.
<display:table name="sessionScope.employees" pagesize="10" cellpadding="2" cellspacing="0"
decorator="org.hannibal.utils.view.decorators.ColspanTableDecorator">
I hope this will help you