Hansjörg Meuschel wrote:
Simon Kitching wrote:

Hansjörg Meuschel wrote:

Hi,
the problem is the surrounding t:datatable: Children of this component all get the same id as the component does not create new objects for each iteration.


That's just not true.

Both the h:dataTable and t:dataTable components use the "flyweight" pattern to avoid creating a component-per-row. However they ensure that the id effectively varies per row for the component, making this transparent for most purposes.

oh ok... i don't know exactly all implementation details, however what i know is that the t:datatable has some serious problems:

Example:
<h:form>
<t:datatable>
<t:column>
<h:inputText>
</ ...>

THIS WILL NOT WORK! (all input field get the same id)


<h:form>
<h:datatable>
<h:column>
<h:inputText>
</ ...>
THIS WILL WORK! (all input field get different ids)

This is the reason why the t:datatable can't be used with submittable componenents! Or am I doing something very wrong here ??

You're doing something very wrong, though I don't know what. Input fields in tables work fine for me, in MyFaces 1.1.1 and SVN head (I haven't tried older versions).

Note that the *id* of the component stays the same, but the *clientId* changes. Given
 <h:form id="form1">
  <h:dataTable id="table1">
   <h:column>
    <h:inputText id="input1">

During rendering, the *same* input-text component is called once per row. If it calls getId(), it sees "input1". However if it calls "getClientId", it sees:
  form1:table1:0:input1
  form1:table1:1:input1
  form1:table1:2:input1
which are all unique ids.

Same process occurs during decoding of submitted values, so each submitted value gets processed correctly.

I also had a collapsible panel within a table and had that working a few months ago. I've deleted that code since, though, as I've taken a different approach to presenting that data.

Note that there have been some problems reported recently regarding tomahawk on sun's JSF RI implementation which *might* be related. I've only tried this on the MyFaces JSF implementation.

Regards,

Simon

Reply via email to