You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by vos <so...@gmail.com> on 2009/10/29 13:51:51 UTC
T5 : Pop up with grid
Hi,
I have a pop up with a grid. When i click in a line of my grid, i want to
get the object for the clicked row.
here is the parent .tml which call the pop up :
<script type="text/javascript">
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=800,height=600,scrollbars=yes');
return false;
}
</script>
...
<p><t:label for="departure">
${message:search-departure}
</t:label>
<t:textfield t:id="departure" t:value="departure.name"
t:validate="required" />
< a t:type="pagelink" t:page="itinerary/AddressListPopUp"
t:context="'0'"
onClick="return popup(this,'AddressListPopUp');">Listes d'adresses
</p>
Here is the .tml for the pop up.
sgPoi is an object with : id, name
<div id="poiList">
<h3>${message:sgPoiList-title}</h3>
<table t:id="sgPoiGrid" t:model="sgPoiGridModel" t:type="grid"
t:row="sgPoi" t:source="sgPoiList" t:rowIndex="rowIndex"
t:rowClass="rowClass" t:rowsPerPage="${message:rowsPerPage}"
t:inplace="true">
<t:parameter name="selectCell">
<t:actionlink t:id="selectAddressPoi" t:context="sgPoi.id">
${message:select-label}
</t:actionlink>
</t:parameter>
</table>
</div>
Here is the java controller for my actionlink:
@OnEvent(value = "action", component = "selectAddressPoi")
public void onSelectEvent(Integer id) {
String name = this.sgPoiManager.getSgPoiById(id).getName;
//TODO how to complete the textfield "departure" in the parent window ???
}
I don't know what is the best way to complete the textfield "departure" in
the parent window with the Name of the SgPoi selected.
How can i get the opener page in my java class ?
Thanks by advance.
--
View this message in context: http://www.nabble.com/T5-%3A-Pop-up-with-grid-tp26112459p26112459.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 : Pop up with grid
Posted by cordenier christophe <ch...@gmail.com>.
Hi
You can also have a look at
http://www.chenillekit.org/demo/tapcomp/oneventdemo
to see how Ajax call can be made easily with Tapestry and ChenilleKit
2009/10/29 cordenier christophe <ch...@gmail.com>
> And Render Request of course.
>
> So you can also re-render the page and use the RenderSupport to add your
> Javascript.
>
> When the user click on the link, try to update the a state in your page
> (keep it via @Persist or Activation/Passivation), and during re-render, add
> your javascript call in SetupRender.
>
> And Ajax update is maybe cleaner...
>
> Excuse me for my previous confusing answers.
>
> Regards,
> Christope.
>
> 2009/10/29 cordenier christophe <ch...@gmail.com>
>
> Sorry i have said something wrong, RenderSupport is not available in
>> Action Request, only in Ajax Action Request.
>>
>> 2009/10/29 vos <so...@gmail.com>
>>
>>>
>>> Hi Christophe,
>>> Thanks for your answer.
>>> I tried to code with the renderSupport as you told me.
>>>
>>> here is the javascript for my pop up
>>>
>>> <script type="text/javascript">
>>> function choisir(choix){
>>>
>>>
>>>
>>> window.opener.document.forms["add_search_form"].elements["departure"].value=choix;
>>>
>>> self.close();
>>> }
>>> </script>
>>>
>>>
>>> and the .java :
>>>
>>> @Environmental
>>> private RenderSupport renderSupport;
>>>
>>> @OnEvent(value = "action", component = "selectAddressPoi")
>>> public void onSelectEvent(Integer id) {
>>> System.out.println(id);
>>> String name =
>>> this.sgPoiManager.getSgPoiById(id).getName();
>>> this.renderSupport.addScript("choisir(" + name + ");");
>>> }
>>>
>>> I got this exception when i clicked on my button :
>>>
>>> No object of type org.apache.tapestry5.RenderSupport is available from
>>> the
>>> Environment. Available types are
>>> org.apache.tapestry5.services.ComponentEventResultProcessor.
>>>
>>> what is the problem with the renderSupport ?
>>>
>>> Thanks by advance
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/T5-%3A-Pop-up-with-grid-tp26112459p26113362.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>
Re: T5 : Pop up with grid
Posted by Shing Hing Man <ma...@yahoo.com>.
I have a simple parent-child page demo at
http://lombok.demon.co.uk/tapestry5Demo/test/parentwindow
The parent page displays number 1,2,..., n.
The child page is a pop up to change n.
The entered n from the pop up is returned to the parent page and the parent page is redisplay with the new n.
It works in firefox, but not in IE.
Shing
--- On Thu, 29/10/09, cordenier christophe <ch...@gmail.com> wrote:
> From: cordenier christophe <ch...@gmail.com>
> Subject: Re: T5 : Pop up with grid
> To: "Tapestry users" <us...@tapestry.apache.org>
> Date: Thursday, 29 October, 2009, 10:13 PM
> And Render Request of course.
>
> So you can also re-render the page and use the
> RenderSupport to add your
> Javascript.
>
> When the user click on the link, try to update the a state
> in your page
> (keep it via @Persist or Activation/Passivation), and
> during re-render, add
> your javascript call in SetupRender.
>
> And Ajax update is maybe cleaner...
>
> Excuse me for my previous confusing answers.
>
> Regards,
> Christope.
>
> 2009/10/29 cordenier christophe <ch...@gmail.com>
>
> > Sorry i have said something wrong, RenderSupport
> is not available in
> > Action Request, only in Ajax Action Request.
> >
> > 2009/10/29 vos <so...@gmail.com>
> >
> >>
> >> Hi Christophe,
> >> Thanks for your answer.
> >> I tried to code with the renderSupport as you told
> me.
> >>
> >> here is the javascript for my pop up
> >>
> >> <script
> type="text/javascript">
> >> function
> choisir(choix){
> >>
> >>
> >>
> >>
> window.opener.document.forms["add_search_form"].elements["departure"].value=choix;
> >>
> >>
> self.close();
> >>
> }
> >> </script>
> >>
> >>
> >> and the .java :
> >>
> >> @Environmental
> >> private RenderSupport
> renderSupport;
> >>
> >> @OnEvent(value =
> "action", component = "selectAddressPoi")
> >> public void
> onSelectEvent(Integer id) {
> >>
> System.out.println(id);
> >>
> String name =
> this.sgPoiManager.getSgPoiById(id).getName();
> >>
> this.renderSupport.addScript("choisir(" + name +
> ");");
> >> }
> >>
> >> I got this exception when i clicked on my button
> :
> >>
> >> No object of type
> org.apache.tapestry5.RenderSupport is available from the
> >> Environment. Available types are
> >>
> org.apache.tapestry5.services.ComponentEventResultProcessor.
> >>
> >> what is the problem with the renderSupport ?
> >>
> >> Thanks by advance
> >>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/T5-%3A-Pop-up-with-grid-tp26112459p26113362.html
> >> Sent from the Tapestry - User mailing list archive
> at Nabble.com.
> >>
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 : Pop up with grid
Posted by cordenier christophe <ch...@gmail.com>.
And Render Request of course.
So you can also re-render the page and use the RenderSupport to add your
Javascript.
When the user click on the link, try to update the a state in your page
(keep it via @Persist or Activation/Passivation), and during re-render, add
your javascript call in SetupRender.
And Ajax update is maybe cleaner...
Excuse me for my previous confusing answers.
Regards,
Christope.
2009/10/29 cordenier christophe <ch...@gmail.com>
> Sorry i have said something wrong, RenderSupport is not available in
> Action Request, only in Ajax Action Request.
>
> 2009/10/29 vos <so...@gmail.com>
>
>>
>> Hi Christophe,
>> Thanks for your answer.
>> I tried to code with the renderSupport as you told me.
>>
>> here is the javascript for my pop up
>>
>> <script type="text/javascript">
>> function choisir(choix){
>>
>>
>>
>> window.opener.document.forms["add_search_form"].elements["departure"].value=choix;
>>
>> self.close();
>> }
>> </script>
>>
>>
>> and the .java :
>>
>> @Environmental
>> private RenderSupport renderSupport;
>>
>> @OnEvent(value = "action", component = "selectAddressPoi")
>> public void onSelectEvent(Integer id) {
>> System.out.println(id);
>> String name = this.sgPoiManager.getSgPoiById(id).getName();
>> this.renderSupport.addScript("choisir(" + name + ");");
>> }
>>
>> I got this exception when i clicked on my button :
>>
>> No object of type org.apache.tapestry5.RenderSupport is available from the
>> Environment. Available types are
>> org.apache.tapestry5.services.ComponentEventResultProcessor.
>>
>> what is the problem with the renderSupport ?
>>
>> Thanks by advance
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T5-%3A-Pop-up-with-grid-tp26112459p26113362.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
Re: T5 : Pop up with grid
Posted by cordenier christophe <ch...@gmail.com>.
Sorry i have said something wrong, RenderSupport is not available in Action
Request, only in Ajax Action Request.
2009/10/29 vos <so...@gmail.com>
>
> Hi Christophe,
> Thanks for your answer.
> I tried to code with the renderSupport as you told me.
>
> here is the javascript for my pop up
>
> <script type="text/javascript">
> function choisir(choix){
>
>
>
> window.opener.document.forms["add_search_form"].elements["departure"].value=choix;
>
> self.close();
> }
> </script>
>
>
> and the .java :
>
> @Environmental
> private RenderSupport renderSupport;
>
> @OnEvent(value = "action", component = "selectAddressPoi")
> public void onSelectEvent(Integer id) {
> System.out.println(id);
> String name = this.sgPoiManager.getSgPoiById(id).getName();
> this.renderSupport.addScript("choisir(" + name + ");");
> }
>
> I got this exception when i clicked on my button :
>
> No object of type org.apache.tapestry5.RenderSupport is available from the
> Environment. Available types are
> org.apache.tapestry5.services.ComponentEventResultProcessor.
>
> what is the problem with the renderSupport ?
>
> Thanks by advance
>
>
> --
> View this message in context:
> http://www.nabble.com/T5-%3A-Pop-up-with-grid-tp26112459p26113362.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: T5 : Pop up with grid
Posted by vos <so...@gmail.com>.
Hi Christophe,
Thanks for your answer.
I tried to code with the renderSupport as you told me.
here is the javascript for my pop up
<script type="text/javascript">
function choisir(choix){
window.opener.document.forms["add_search_form"].elements["departure"].value=choix;
self.close();
}
</script>
and the .java :
@Environmental
private RenderSupport renderSupport;
@OnEvent(value = "action", component = "selectAddressPoi")
public void onSelectEvent(Integer id) {
System.out.println(id);
String name = this.sgPoiManager.getSgPoiById(id).getName();
this.renderSupport.addScript("choisir(" + name + ");");
}
I got this exception when i clicked on my button :
No object of type org.apache.tapestry5.RenderSupport is available from the
Environment. Available types are
org.apache.tapestry5.services.ComponentEventResultProcessor.
what is the problem with the renderSupport ?
Thanks by advance
--
View this message in context: http://www.nabble.com/T5-%3A-Pop-up-with-grid-tp26112459p26113362.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 : Pop up with grid
Posted by cordenier christophe <ch...@gmail.com>.
Hello
>>How can i get the opener page in my java class ?
To update a field on the opener, you have to do it with Javascript, not on
server side. There is many alternatives for this :
- Using Ajax request on link click to get the name from server side and
update client via Javascript
- Do it with a simple action link that render Javascript via RenderSupport,
the javascript will update the field and close the popup
- Using Javascript for popup instean of window.open to ease Javascript stuff
But in your case, because you have already implemented a popup solution, i
think the second should be enough.
Regards,
Christophe.
2009/10/29 vos <so...@gmail.com>
>
> Hi,
> I have a pop up with a grid. When i click in a line of my grid, i want to
> get the object for the clicked row.
>
>
> here is the parent .tml which call the pop up :
>
> <script type="text/javascript">
> function popup(mylink, windowname)
> {
> if (! window.focus)return true;
> var href;
> if (typeof(mylink) == 'string')
> href=mylink;
> else
> href=mylink.href;
> window.open(href, windowname, 'width=800,height=600,scrollbars=yes');
> return false;
> }
> </script>
> ...
>
> <p><t:label for="departure">
> ${message:search-departure}
> </t:label>
> <t:textfield t:id="departure" t:value="departure.name"
> t:validate="required" />
> < a t:type="pagelink" t:page="itinerary/AddressListPopUp"
> t:context="'0'"
> onClick="return popup(this,'AddressListPopUp');">Listes
> d'adresses
> </p>
>
>
> Here is the .tml for the pop up.
>
> sgPoi is an object with : id, name
>
>
> <div id="poiList">
> <h3>${message:sgPoiList-title}</h3>
> <table t:id="sgPoiGrid" t:model="sgPoiGridModel" t:type="grid"
> t:row="sgPoi" t:source="sgPoiList" t:rowIndex="rowIndex"
> t:rowClass="rowClass" t:rowsPerPage="${message:rowsPerPage}"
> t:inplace="true">
> <t:parameter name="selectCell">
> <t:actionlink t:id="selectAddressPoi" t:context="sgPoi.id">
> ${message:select-label}
> </t:actionlink>
> </t:parameter>
>
> </table>
> </div>
>
> Here is the java controller for my actionlink:
>
> @OnEvent(value = "action", component = "selectAddressPoi")
> public void onSelectEvent(Integer id) {
> String name = this.sgPoiManager.getSgPoiById(id).getName;
> //TODO how to complete the textfield "departure" in the
> parent window ???
> }
>
>
>
>
> I don't know what is the best way to complete the textfield "departure" in
> the parent window with the Name of the SgPoi selected.
> How can i get the opener page in my java class ?
>
> Thanks by advance.
>
> --
> View this message in context:
> http://www.nabble.com/T5-%3A-Pop-up-with-grid-tp26112459p26112459.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>