zhoupan / jmesa

Automatically exported from code.google.com/p/jmesa
0 stars 0 forks source link

Adding multiple columns without property defined will render samen content in every cell as last cell #172

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a table with JMesa using tags (example included)
2. Make some table cells empty (do not define a property) for instance for
static content like action links.

What is the expected output? What do you see instead?
I expect different content in each cell, but the content in the last three
cells is the same (see the sample code)

What version of the product are you using? On what operating system?
2.3.4

Please provide any additional information below.

Sample JSP page:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="nl.Data" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="jmesa" uri="/jmesa" %>

<%
    List list = new ArrayList();
    for(int i = 0 ; i < 10 ; i++) {
        Data data = new Data();
        data.setName("name");
        data.setValue1("value");
        data.setValue2("value");
        data.setValue3("value");
        list.add(data);
    }

    pageContext.setAttribute("list", list);
%>

<jmesa:tableFacade id="table" items="${pageScope.list}" var="item">
    <jmesa:htmlTable captionKey="table.caption">
        <jmesa:htmlRow>
            <jmesa:htmlColumn property="name"/>
            <jmesa:htmlColumn property="value1"/>
            <jmesa:htmlColumn property="value2"/>
            <jmesa:htmlColumn property="value3" filterable="false">
                <a href="/link_value3"><span>edit</span></a>
            </jmesa:htmlColumn>
            <jmesa:htmlColumn styleClass="tool edit" filterable="false">
                <a href="/link_3_edit"><span>edit</span></a>
            </jmesa:htmlColumn>
            <jmesa:htmlColumn styleClass="tool add" filterable="false">
                <a href="/link_3_add"><span>add</span></a>
            </jmesa:htmlColumn>
            <jmesa:htmlColumn styleClass="tool delete" filterable="false">
                <a href="/link_3_delete"><span>delete</span></a>
            </jmesa:htmlColumn>
        </jmesa:htmlRow>
    </jmesa:htmlTable>
</jmesa:tableFacade>

Sample data object:

public class Data
{   
    private String name;

    private String value1;
    private String value2;
    private String value3;

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getValue1()
    {
        return value1;
    }

    public void setValue1(String value1)
    {
        this.value1 = value1;
    }

    public String getValue2()
    {
        return value2;
    }

    public void setValue2(String value2)
    {
        this.value2 = value2;
    }

    public String getValue3()
    {
        return value3;
    }

    public void setValue3(String value3)
    {
        this.value3 = value3;
    }
}

Original issue reported on code.google.com by wijngaa...@gmail.com on 30 Dec 2008 at 4:30

GoogleCodeExporter commented 9 years ago
Yes. This is a bug.

http://code.google.com/p/jmesa/issues/detail?id=79

What you can do is define a column and give it a made up name. For instance if 
you
have a column for checkboxes you can call the property chkbx, or whatever you 
want.
The important thing is the column properties are unique.

Original comment by jeff.johnston.mn@gmail.com on 7 Jan 2009 at 3:36