Hi Volker!

many thanks for your help. The problem with the equal component ids in the
logging output was caused by using dataModel.setRowIndex() instead of
uiData.setRowIndex() to access a row object.

But why can't dataModel.setRowIndex() be used?

I have used dataModel.getRowData() successfully already, so why not
dataModel.setRowIndex()?


> There is just one UIComponent, not one for each row! Thats the reason
> why i don't think it could be usefull to have a component binding inside
> of a dataTable. If you realy need to access the components i think its
> easier to have the binding on the UIData, as you need to do
> uidata.setRowIndex() to populate the values.

I need the component-binding to the inputText in the dataTable to add custom
error messages to the inputText in a custom validator. I can access the
clientId of the inputText needed for a component-specific error message by
using the component-binding. Do you see an alternative to the
component-binding? (What comes to my mind is traversing the component tree
instead.)


Regards,

Matthias



> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Auftrag
> von Volker Weber
> Gesendet: Donnerstag, 5. Januar 2006 18:53
> An: MyFaces Discussion
> Betreff: Re: AW: Problem text with inputText rendering behaviour in a
> dataTable
>
>
> Hi,
>
> Matthias Kahlau wrote:
> > Hi Volker!
> >
> >
> > I chose a different solution in the meantime, without using a immediate
> > command. So the model values are updated. I had to omit the required
> > validator of the inputText in the dataTable using this approach to avoid
> > validation errors on non-save actions which target to the same JSF page.
> >
> > I use the component-binding on the inputText in the dataTable
> to add error
> > messages to the component.
> >
> > And that's where I have a current problem. I could observe that
> the clientId
> > of that inputText is the same for all inputText used in the
> dataTable (if I
> > set it explicitely or not) .
>
> The clientId should not always the same, because the clientid is
> generated by the components id prefixed by the dataTables clientId,
> which is different for each row.
>
> So adding an error message to a specific
> > component doesn't work. There's no error message shown in the
> h:message tag
> > of that component. Furthermore, if I want to use the h:message
> tag for the
> > inputText, I have to specify the "for" attribute pointing to
> the id of the
> > inputText, and so I also have to specify the id for the
> inputText, which can
> > only be a static value.
>
> If your h:message tag is also inside the table (on the same row), then
> IMHO it should work setting the 'for' to the inputs 'id'.
>
> >
> > I just tried to use a component-binding for the h:message tag of the
> > inputText to show an error message, but this also didn't work:
> >
> > for (...) {
> >
> >     ...
> >     FacesContext context = FacesContext.getCurrentInstance();
> >     this.dataModel.setRowIndex(i);
> >     String clientID =
> this.messageAuswahlmoeglichkeit.getClientId(context);
>
> Did you get here the same clientId for all rows?
>
> >     context.addMessage(clientID, msg);
> > }
> >
> >
> > I tried the same with the inputText component-binding, also
> without success.
> >
> > Do you know if this is possible, and how?
>
> If the above not work, please post your jsp code.
>
> >
> >
> > The problem is also, that I don't really understand how the
> > component-binding works for a component used inside a
> dataTable. Are there
> > many instances of this component used internally, one for each
> row, or how
> > does it work. I only know that I can access a component of a
> specific row by
> > using this.dataModel.setRowIndex()...
>
> There is just one UIComponent, not one for each row! Thats the reason
> why i don't think it could be usefull to have a component binding inside
> of a dataTable. If you realy need to access the components i think its
> easier to have the binding on the UIData, as you need to do
> uidata.setRowIndex() to populate the values.
>
> >
> >
> > Regards,
> >
> > Matthias
> >
> >
> >>-----Ursprüngliche Nachricht-----
> >>Von: [EMAIL PROTECTED]
> >>[mailto:[EMAIL PROTECTED] Auftrag
> >>von Volker Weber
> >>Gesendet: Donnerstag, 5. Januar 2006 16:41
> >>An: MyFaces Discussion
> >>Betreff: Re: Problem text with inputText rendering behaviour in a
> >>dataTable
> >>
> >>
> >>Hi Matthias,
> >>
> >>Matthias Kahlau wrote:
> >>
> >>>Hi!
> >>>
> >>>
> >>>I have a strange problem using inputText in each row of dataTable.
> >>>
> >>>The inputText has a component-binding to a session-scoped Backing-Bean.
> >>>
> >>>I use an immediate commandButton to delete some selected rows.
> >>>
> >>>When the JSF page is redisplayed after deleting the last row
> >>
> >>with an empty
> >>
> >>>inputText, all inputText in the table are rendered empty,
> although model
> >>>values of these rows have been set before submitting the page
> >>
> >>to delete some
> >>
> >>>rows.
> >>>
> >>>This happens both with the delete action-method having a "null"
> >>
> >>return value
> >>
> >>>and a "non-null" return value pointing to the same page.
> >>>
> >>>I expected the inputText to render the component values if a
> >>
> >>"null" return
> >>
> >>>value is used, if the component values are "non-null", what is
> the case.
> >>>
> >>>And I expected the inputText to render the model values if a "non-null"
> >>>return value is used (because a new view had been created) -
> >>
> >>and the model
> >>
> >>>values are "non-null".
> >>>(But is it possible in this case, that the inputText component value is
> >>>rendered because of using component-binding, although a new View is
> >>>created?)
> >>
> >>You have a component binding on a component inside a dataTable? I don't
> >>know if this could be the reason for your problem, but i can't see any
> >>reason to have this. Did you access this component in your code?
> >>
> >>Can you test without this binding?
> >>
> >>Regards,
> >>  Volker
> >>
> >>--
> >>Don't answer to From: address!
> >>Mail to this account are droped if not recieved via mailinglist.
> >>To contact me direct create the mail address by
> >>concatenating my forename to my senders domain.
> >
> >
>
> --
> Don't answer to From: address!
> Mail to this account are droped if not recieved via mailinglist.
> To contact me direct create the mail address by
> concatenating my forename to my senders domain.

Reply via email to