Hi Onur,

Having dynamic columns, and setting the DataModel are two unrelated issues. The first controls the "width" of the table. The second controls its "height" (ie the number of rows rendered).

Even when all the columns have only static text the table will still render the number of rows corresponding to the number of objects in the DataModel.

If you aren't providing a data model to the table, then that would explain why your table only has headers! Without a datamodel, how is the table supposed to know how many rows to render?

Regards,

Simon,

Onur Tokan wrote:
Thank you simon,

I've already tried to set unique id. I think we are missing something.
Maybe expert team members may show the way to do it. I've read all the
forum postings before asking here. There is no exact answer about this
topic. Maybe UIData component doesn't not support dynamic columns. Is
it madatory to set DataModel attribute of UIData.

Best regards,

Onur

On 12/8/05, Simon Kitching <[EMAIL PROTECTED]> wrote:
Onur Tokan wrote:
I have a problem about creating dynamic HtmlDataTable component. The
following code renders only the column's facets. NOT the CONTENTS...
Thanks...

HtmlDataTable dataTable = new HtmlDataTable();
for (int i = 1; i <= 10 i++)
{
      UIColumn column = new UIColumn();
      HtmlOutputText header = new HtmlOutputText();
      header.setValue("Column Header"+i);
      column.setHeader(header);
      for (int j = 1; j <= 100 j++)
      {
              HtmlOutputText rowText = new HtmlOutputText();
              rowText.setValue("Row:"+j+"Column:"+i);
              column.getChildren().add(rowText);
      }
      dataTable.getChildren().add(column);

}
return dataTable;
It looks ok to me.

One things you should do is explicitly assign an id to each component
you create. All programmatically-created components should do this. And
of course you need to invent some id-generator code to ensure that the
assigned ids are all unique. However I doubt that this is the cause of
your problem...

Regards,

Simon




Reply via email to