Hi,

Please use ExpressionTableColumn rather than
SimpleTableColumn in your code -- that will allow you
to extract the value you want in that column using
OGNL. SimpleTableColumn does not do that unless you
override it or set an evaluator.

Also, what was wrong with the source/columns approach?
It should be perfect for the task...

-mb

--- Darío Vasconcelos <[EMAIL PROTECTED]>
wrote:

> Hi,
> 
> I'm trying to get a contrib:Table to accept as
> dataModel an ArrayList
> of HashMaps. This kind of ArrayList has been great
> inside Foreach
> components, since the hashmap's keys are easily
> referenced with ognl.
> Now I need the paging and sorting functionality, so
> the Table is the
> obvious choice.
> 
> So far, all the cells in a row have the same display
> value (which is
> the toString() of the HashMap). I'm pretty sure I'm
> doing something
> wrong but can't figure out what it is.
> 
> My .html:
> <table jwcid="@contrib:Table"
> tableModel="ognl:table" >
> 
> My .java:
> public ITableModel getTable() {
>  ...
>  ...  // some uninteresting details
>  ...
>  Set columns = ((HashMap)list.get(0)).keySet();
>  ITableColumn[] columnsList = new
> ITableColumn[columns.size()];
>  Iterator it  = columns.iterator();
>  int i = 0;
>  while (it.hasNext()) 
>        columnsList[i++] = new
> SimpleTableColumn((String)it.next());
> 
>  return new SimpleTableModel(new
> SimpleListTableDataModel(list),
>                                                 new 
> SimpleTableColumnModel(columnsList));
> }
> 
> The object named "list" is an ArrayList filled with
> HashMap objects.
> Each HashMap has the values of the cells associated
> to their column
> name, that's why I can get the column names from the
> first HashMap in
> the ArrayList.
> 
> I know the ArrayList is not empty, and that the
> ITableColumn is
> correctly filled. Where is the error?
> 
> Regards,
> 
> Dario
> 
> 
> PS. BTW, I also tried using the source and columns
> parameters instead
> of the tableModel...
> -- 
> Communism is man's exploitation of man. Capitalism
> is just the opposite.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to