Re: Dynamically refer to a component from another component

2006-01-20 Thread Enrique Medina
Hi Simon,Yes, that was exactly the point. It's as easy as adding all the children, and at the end of the tree component creation, call to getClientId().Thanks a lot for your support. 2006/1/19, Simon Kitching [EMAIL PROTECTED]: I believe Volker's answer is exactly what you're looking for.

Re: Dynamically refer to a component from another component

2006-01-20 Thread Enrique Medina
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

Re: Dynamically refer to a component from another component

2006-01-20 Thread Simon Kitching
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

Re: Dynamically refer to a component from another component

2006-01-20 Thread Volker Weber
Hi Enrique, the '_0' is added by the datatable while rendering row 1 (index 0). This is needed to generate uniqe ids over multiple rows. Looks like you have nested datatables? To get the '_0' you can call setRowIndex(0) on the datatable component, but if your table contains more rows the ids

Re: Dynamically refer to a component from another component

2006-01-20 Thread Enrique Medina
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

Re: Dynamically refer to a component from another component

2006-01-20 Thread Volker Weber
BTW: if i remember correct the generated row index is changed to ':0' in svn. Volker Weber wrote: Hi Enrique, the '_0' is added by the datatable while rendering row 1 (index 0). This is needed to generate uniqe ids over multiple rows. Looks like you have nested datatables? To get the

Re: Dynamically refer to a component from another component

2006-01-20 Thread Simon Kitching
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

Re: Dynamically refer to a component from another component

2006-01-20 Thread Enrique Medina
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

Re: Dynamically refer to a component from another component

2006-01-20 Thread Simon Kitching
On Fri, 2006-01-20 at 12:04 +0100, Enrique Medina wrote: 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

RE: Dynamically refer to a component from another component

2006-01-20 Thread Jesse Alexander \(KBSA 21\)
You could help _javascript_ by generating a hidden field with a given id and the number of rows as value... hth Alexander From: Enrique Medina [mailto:[EMAIL PROTECTED] Sent: Friday, January 20, 2006 12:05 PMTo: [EMAIL PROTECTED]; MyFaces DiscussionSubject: Re: Dynamically refer

Re: Dynamically refer to a component from another component

2006-01-20 Thread Enrique Medina
I see. But it's not that exactly. Suppose I have a button associated to each INPUT object, that when clicked must perform a particular action for the value of the INPUT associated, not another... 2006/1/20, Simon Kitching [EMAIL PROTECTED]: On Fri, 2006-01-20 at 12:04 +0100, Enrique Medina wrote:

Re: Dynamically refer to a component from another component

2006-01-20 Thread Enrique Medina
For those who might be interested...FInally I solved my problem. When the dataTable is being rendered, then it uses both the row number and the col number to generate the IDs, so I made use of the rowIndexVar and var properties of DataTable and UIColumns respectively to be able to access this

Re: Dynamically refer to a component from another component

2006-01-19 Thread Simon Kitching
http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother On Thu, 2006-01-19 at 12:57 +0100, Enrique Medina wrote: Anyone can give me some hints on how to refer from one component to another using EL, or maybe when creating the components dynamically through code?

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
Hi Simon,I mean accesing one component to another from inside the same bean2006/1/19, Simon Kitching [EMAIL PROTECTED]: http://wiki.apache.org/myfaces/AccessingOneManagedBeanFromAnother On Thu, 2006-01-19 at 12:57 +0100, Enrique Medina wrote: Anyone can give me some hints on how to refer from one

Re: Dynamically refer to a component from another component

2006-01-19 Thread Mario Ivankovits
Hi Enrique! But this is what Simon tries to show you. Its possible to inject the other bean instance or to look it up through the context. Ciao, Mario Hi Simon, I mean accesing one component to another from inside the same bean 2006/1/19, Simon Kitching [EMAIL PROTECTED] mailto:[EMAIL

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer to an HtmlInputText from another HtmlOutputText.The problem I have is that I need to refer to the value of one component from another one in code, and both of them are

RE: Dynamically refer to a component from another component

2006-01-19 Thread Jesse Alexander \(KBSA 21\)
in UIComponent Could this be a ticket to ride? Alexander From: Enrique Medina [mailto:[EMAIL PROTECTED] Sent: Thursday, January 19, 2006 2:48 PMTo: MyFaces DiscussionSubject: Re: Dynamically refer to a component from another component But I don't want to inject another bean. When I talk about components

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
Medina [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 19, 2006 2:48 PMTo: MyFaces DiscussionSubject: Re: Dynamically refer to a component from another component But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer

Re: Dynamically refer to a component from another component

2006-01-19 Thread Volker Weber
Hi, Enrique Medina wrote: But I don't want to inject another bean. When I talk about components I mean view components in the model component; e.g. refer to an HtmlInputText from another HtmlOutputText. The problem I have is that I need to refer to the value of one component from another

Re: Dynamically refer to a component from another component

2006-01-19 Thread Mario Ivankovits
Enrique Medina schrieb: The problem is I don't know the HTML ID until the page is rendered, and that ID is the one I want to refer in code, as it will be the input to a Javascript method. and what if you set a binding in your created components so they will automatically register to your

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
Let me give a more detailed explanation of what I am trying to achieve..In my application I need to work with data in a spreadsheet form, so I decided to use a PanelTabbed component, where each tab would contain a HtmlDataTable. All these would simulate an Excel page, where I can change the actual

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
Also I forgot to say, that if I wanted to use the onclick method on the same UIInput component, I could define it easily by: texto4.getAttributes().put(onclick, validate(this.value)); As you can see, I know that 'this' refers to my component. But what happens if I need to refer to texto4 component

Re: Dynamically refer to a component from another component

2006-01-19 Thread Volker Weber
Hi, you can get the rendered 'htmlId' of a component by component.getCientId(facesContext); so you can do : UIOutput texto5 = (HtmlOutputText) FacesUtils.getApplication() .createComponent(HtmlOutputText.COMPONENT_TYPE); texto5.getAttributes().put(onclick, validate(' +

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
I tried that, but at the time of creating the component in code, texto4.getClientId(facesContext) returns exactly the same used before when texto4.setId(_input), so it doesn't help at all 2006/1/19, Volker Weber [EMAIL PROTECTED]: Hi,you can get the rendered 'htmlId' of a component

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
See what is generated at runtime:input id=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input name=bodySubview:_id23:tablaEdicionPuntuaciones0_1:_id24_4_0:_input type= text value=12 onclick=myAlert(_input.value) class=txt /And obviously, a component with _input ID does not exist,

Re: Dynamically refer to a component from another component

2006-01-19 Thread Volker Weber
After adding the component to the component tree the full id should returned. The structure of the tree is needed to create this id. This is what is done when rendering the 'htlmId' in the renderer. Without the tree structue there is no way to find the resulting clientId. Regards, Volker

Re: Dynamically refer to a component from another component

2006-01-19 Thread Enrique Medina
So your answer means that there is no way to accomplish what I am trying, isn't it?Maybe using some kind of events, when the component is created to advise another one or so?2006/1/19, Volker Weber [EMAIL PROTECTED]: After adding the component to the component tree the full id shouldreturned. The

Re: Dynamically refer to a component from another component

2006-01-19 Thread Simon Kitching
I believe Volker's answer is exactly what you're looking for. Unless I've misunderstood your question, method getClientId is what you want; you just need to make sure the component is attached to the view tree before calling that method. ie: UIOutput texto4 = createComponent(..);

RE: Dynamically refer to a component from another component

2006-01-19 Thread Jesse Alexander \(KBSA 21\)
No he says: You need to add the component to its parent component before you can receive a usefull clientId. hthAlexander From: Enrique Medina [mailto:[EMAIL PROTECTED] Sent: Thursday, January 19, 2006 5:12 PMTo: MyFaces DiscussionSubject: Re: Dynamically refer to a component from