|
List Info
Thread: : how to get the id of the current element to pass it to a function
|
|
| : how to get the id of the current
element to pass it to a function |

|
2007-10-08 09:04:59 |
|
Hi Tobago friends,
I have a question for all JSF users (th'at's why I wrote +obago for those who have filters). I'd like to let each user choose what he wants displayed in his/her label and link fields. So I wrote a function that I'd like to call this way for example:
<tc:column
>
<
tc:link label
="#{itf:toString(contract.client, 'xxxx'
)}"></
tc:link>
</tc:column
>
Where I'd like to have in xxxx the id of the current element.&n bsp; Does anyone have a solution to insert it automatically through javascript or an el expression?
I think javascript could be a good candidte sth like
function( tag ) {
}
But I'm really bad in js, I don't know when it gets called, how to call it to fill in the value at page load, and fetures like that...
I'd be very happy if someone can help.
Cheers and folks,
Zied
|
| AW: : how to get the id of the current
element to pass it to a function |
  Germany |
2007-10-08 09:38:41 |
|
Hi Zied,
I think the tag <tc:script/>
is the solution. It has several attributes like “onload” or “onexit”.
You should place it inside <tc:page>. Here a skeleton:
<f:view>
<script language=”javascript”;>
function doIt(){
alert(R20;Welcome”);
}
</script>
<tc:page>
<tc:script onload=221;doIt()”/>
…your content230;
</tc:page>
</f:view>
Hope it helps.
Regards, Mario
Von: Zied Hamdi
[mailto:javahamdi gmail.com]
Gesendet: Montag, 8. Oktober 2007
16:05
An: MyFaces
Betreff: [JSF] and maybe [+obago]
: how to get the id of the current element to pass it to a function
I have a question for all JSF users (th'at's why I wrote +obago for
those who have filters). I'd like to let each user choose what he wants
displayed in his/her label and link fields. So I wrote a function that I'd like
to call this way for example:
<tc:column >
< tc:link label ="#{itf:toString(contract.client, 'xxxx' )}"></ tc:link>
</tc:column >
Where I'd like to have in xxxx the id of the current element. Does anyone
have a solution to insert it automatically through javascript or an el
expression?
I think javascript could be a good candidte sth like
But I'm really bad in js, I don't know when it gets called, how to call
it to fill in the value at page load, and fetures like that...
I'd be very happy if someone can help.
|
| Re: : how to get the id of the current
element to pass it to a function |

|
2007-10-08 09:46:42 |
|
Hi Mario,
Thanks!!! that's great to know. I'll try to search the document for xxxx and replace with the element id.
Though I prefer to let this solution as the no solution approch, In fact I planned to do my own xx:link and xx:label that gets its own id and pass it transaparently with no impact on the owning page...
Anyway it's a great thing to know in general.
Regards,
Zied
2007/10/8, Schröder, Mario < mario.schroeder saxsys.de">mario.schroeder saxsys.de>:
Hi Zied,
I think the tag <tc:script/> is the solution. It has several attributes like "onload" or "onexit". You should place it inside <tc:page>. Here a skeleton:
<f:view>
<script language="javascript">
function doIt(){
alert("Welcome");
}
</script>
<tc:page>
<tc:script onload="doIt()"/>
…your content…
</tc:page>
</f:view>
Hope it helps.
Regards, Mario
I have a question for all JSF users (th'at's why I wrote +obago for those who have filters). I'd like to let each user choose what he wants displayed in his/her label and link fields. So I wrote a function that I'd like to call this way for example:
<tc:column
>
< tc:link
label =
"#{itf:toString(contract.client, '
xxxx'
)}"></
tc:link>
</tc:column
>
Where I'd like to have in xxxx the id of the current element. Does anyone have a solution to insert it automatically through javascript or an el expression?
I think javascript could be a good candidte sth like
But I'm really bad in js, I don't know when it gets called, how to call it to fill in the value at page load, and fetures like that...
I'd be very happy if someone can help.
-- Zied Hamdi
zatreex.sourceforge.net
|
| Re: : how to get the id of the current
element to pass it to a function |
  Sweden |
2007-10-08 09:43:54 |
On Mon, 2007-10-08 at 16:04 +0200, Zied Hamdi wrote:
> Hi Tobago friends,
>
> I have a question for all JSF users (th'at's why I
wrote +obago for
> those who have filters). I'd like to let each user
choose what he
> wants displayed in his/her label and link fields. So I
wrote a
> function that I'd like to call this way for example:
>
> <tc:column>
>
> <tc:link
label="#{itf:toString(contract.client,
> 'xxxx' )}"></tc:link>
>
> </tc:column>
>
>
>
>
>
> Where I'd like to have in xxxx the id of the current
element. Does
> anyone have a solution to insert it automatically
through javascript
> or an el expression?
>
> I think javascript could be a good candidte sth like
>
> function( tag ) {
> return tag.id;
> }
>
> But I'm really bad in js, I don't know when it gets
called, how to
> call it to fill in the value at page load, and fetures
like that...
What exactly are you trying to achieve?
Are you intending to have a database of (labelid, text) per
user on the
server side, and using this table to generate
different-looking html
output for each user?
Or are you going to somehow have a big javascript hashmap on
the client
side with (labelid, text) pairs that you use to post-process
the page
after it has been returned to the browser?
In either case, how is the user going to specify what text
they want?
Or do you mean something else?
Regards,
Simon
|
|
| Re: : how to get the id of the current
element to pass it to a function |

|
2007-10-08 09:58:40 |
|
Hi Simon,
I have a Facelets function wich will act on the server side:
- each user will be able to have its rows in database for specifying the pattern he want to have for a given id
For example let's say the pattern is simply an el expression:
whan I use my facelets tag xx:link it gets the id of the tc:link element it contains and passes it to the facelets function. This one gets the corresponding el expression and returns the resulting string of
itf:toString(contract.client, 'correspondingEl'
where correspondingEl is for example: "#{client.lastName} entred: #{client.entryDate}" for the user1
and "#{client.lastName} sponsored #{client.sponsored.size}" for user2, both expressions will be in database under the key : "JSF id of the link"
For me it's important that this happens as transparently as using a standard tag. The content of the template tag can contain js code naturally, but it inspects alone the id of its content.
Regards,
Zied
2007/10/8, Zied Hamdi < javahamdi gmail.com">javahamdi gmail.com>:
Hi Mario,
Thanks!!! that's great to know. I'll try to search the document for xxxx and replace with the element id.
Though I prefer to let this solution as the no solution approch, In fact I planned to do my own xx:link and xx:label that gets its own id and pass it transaparently with no impact on the owning page...
Anyway it's a great thing to know in general.
Regards,
Zied
2007/10/8, Schröder, Mario <saxsys.de" target="_blank">mario.schroeder saxsys.de>:
Hi Zied,
I think the tag <tc:script/> is the solution. It has several attributes like "onload" or "onexit". You should place it inside <tc:page>. Here a skeleton:
<f:view>
<script language="javascript">
function doIt(){
alert("Welcome");
}
</script>
<tc:page>
<tc:script onload="doIt()"/>
…your content…
</tc:page>
</f:view>
Hope it helps.
Regards, Mario
I have a question for all JSF users (th'at's why I wrote +obago for those who have filters). I'd like to let each user choose what he wants displayed in his/her label and link fields. So I wrote a function that I'd like to call this way for example:
<tc:column
>
< tc:link
label =
"#{itf:toString(contract.client, '
xxxx'
)}"></
tc:link>
</tc:column
>
Where I'd like to have in xxxx the id of the current element. Does anyone have a solution to insert it automatically through javascript or an el expression?
I think javascript could be a good candidte sth like
But I'm really bad in js, I don't know when it gets called, how to call it to fill in the value at page load, and fetures like that...
I'd be very happy if someone can help.
-- Zied Hamdi
zatreex.sourceforge.net
-- Zied Hamdi zatreex.sourceforge.net
|
[1-5]
|
|