如何用显示器制作列斯潘 [英] How to make colspan with display:column

查看:34
本文介绍了如何用显示器制作列斯潘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在display:column中创建一个colspan,所以我尝试如下进行操作:

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']}"> 

但它不起作用,似乎在display:column中不允许使用此属性,所以该怎么做?

but it doesn't work it seems that this property is not allowed in a display:column so how to do that?

推荐答案

要将colspan添加到显示列中,您必须创建

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");            
    }   
}

在jsp中,我是这样使用的.

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

这篇关于如何用显示器制作列斯潘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆