I asked this question in late January but recived no response.. Is that 
possible to do?

Posted my original question at the end of this message..

/Simon

-----Ursprungligt meddelande-----
Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För SourceForge.net
Skickat: den 20 februari 2008 09:40
Till: [EMAIL PROTECTED]
Ämne: [displaytag-user] [displaytag - Help] RE: Creating display tables from 2D 
string ar


Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=4788839
By: ed_j_webb

Have you tried using the 2D array as a datasource for displaytag? You don't
need to define any columns inside the <display:table> element if you want all
the data displayed. It might be smart enough to handle it.

Otherwise you'll have to force your array into a more suitable form such as
an array of Map objects, each Map representing one row and created from the
2nd dimension of your 2D array.

Ed!

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=249318

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user



Hi!

I want to display columns that does not exist as properties in a class. Instead 
I have stored the data in a map.
Let's say I have the following data that I want to display:
key                      col                       value
a1                        b1                        2
a2                        b1                        3                           
a2                        b2                        6
a3                        b2                        2
a3                        b1                        5
a4                        b3                        5
..                          ..
a2000                 b3                        1
a2000                 b20                      3

So the a values range from 1- to ??? ( in the example 2000 ) and the b values 
range from 1-??? ( in the example 20 ).
I want to display the b values as columns with so the example will be:
key                      b1                        b2                        b3 
                       ...                         b20
a1                        2
a2                        3                           6
a3                        5                           2
a4                                                                              
    5
...
a2000                 1                                                         
                                                         3


So adding a new b-value in the datatable would lead to adding a column in the 
displaytag table.

My class storing the data would be something like this:

class DataHolder{
                             private String key; // the unique a-value

                             private Map<String, Integer> map; //containing all 
the b values for the key.
                             
                             public String getKey(){
                                                          return key;
                             }
                             
                             public void setKey(String key){
                                                          this.key = key;
                             }
                             
                             public String getMapValue(String col){
                                                          Integer value = 
map.get(col);
                                                          return value;
                             }

                             public Map getMap(){
                                                          return map;
                             }
                             
                             public void setMap(Map map){
                                                          this.map = map;
                             }

                             public List getColumns(){
                                     List retList = new ArrayList();
                                     Object keys[] = map.keySet().toArray();
                                     for (int i = 0; i < keys.length; i++) {
                                         Object o =  map.get(keys[i]);
                                         retList.add(o);
                                     }
                                     return retList;
                             }
}


Ok, so using this class I want to create the outputtable in displaytag.. how 
can I do this?
As of my understanding I can only display properties that exist in the class. 
In my example the property key, via the 

<%
    List datas = BusinessFacade.getClassDatas(); // returning a list of all the 
ClassData's...
    request.setAttribute("datas", datas);
%>

<display:table name="datas" export="false" sort="list" pagesize="10000" 
defaultorder="descending">
                             <display:column property="key" title="Key" 
sortable="true" headerClass="sortable"/>
                             <!--how to display the columns here???-->
</display:table>


/Simon




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to