Simon,

The problem is that I don't know how many rows I will have, as it depens on the data the user enters in the normal use of the application.

And I need to manipulate the value of the input object using _javascript_, but the value itself must be indicated in code the way you told me in your previous email. See what I mean?

2006/1/20, Simon Kitching <[EMAIL PROTECTED]>:
If your component is a column in a table, and the table has 5 rows then
there will be 5 HTML tags generated for that component. Each needs a
distinct id according to the rules for HTML.

If you're planning on manipulating those objects in _javascript_, your
_javascript_ needs to handle the fact that there are 5 of those HTML
elements around. That's not JSF-specific, that's the nature of the
problem.

On Fri, 2006-01-20 at 11:49 +0100, Enrique Medina wrote:
> Well, the problem is that I'm creating the table in code using a
> DataModel for columns and a DataModel for rows, so at that time the
> row  index is not known, is it?
>
> And as I assign the client ID at code, how can I know the row?
>
> 2006/1/20, Simon Kitching < [EMAIL PROTECTED]>:
>         On Fri, 2006-01-20 at 11:22 +0100, Enrique Medina wrote:
>         > I have been implementing the dynamic creation of my tree
>         component as
>         > you mentioned, i.e. adding all the components to their
>         parents before
>         > calling getClientId().
>         >
>         > But it seems that there is something more to do, looking at
>         the
>         > generated code:
>         >
>         > <input id="tablaEdicionPuntuaciones0_0:_id30_0:_input"
>
>         The extra _0 is because this input component is in the 0th row
>         of a
>         table. A table is also a naming container.
>
>         In order to get the id for a component in a particular row of
>         a table,
>         call
>             tableComponent.setRowIndex(index);
>            someChildComponentOfTable.getClientId(facesContext);
>
>         Normally the above is not necessary, as it's done implicitly
>         by the
>         framework; the renderer for some component in a table is
>         called once for
>         each row of the table, and the component's clientId is set at
>         that time.
>         That's the normal JSF way of rendering: let the framework make
>         calls
>         into the renderer with everything configured correctly. If
>         you're
>         somehow driving rendering while bypassing the normal flow
>         you'll need to
>         ensure the rowIndex is set correctly.
>
>         If you're not getting the "_0" row bit, then clearly your
>         rendering code
>         is not being called in the "normal rendering flow".
>
>         Regards,
>
>         Simon
>
>
>


Reply via email to