You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rich M <ri...@moremagic.com> on 2011/04/05 22:52:31 UTC

Implementation mixin and persistence

Hi,

I have a Page and it has a search form, contained within an ID'ed DIV. I 
made an implementation mixin that initializes an Event observer on the 
on click event of a 'button' in the Page's HTML. The event triggers 
javascript that hides/shows the search form.

That works fine, but I want to add functionality so there is persistence 
of the hide/show state between page refreshes. Documentation recommends 
to delegate persistence to the container using parameters, but I haven't 
seen any documentation that indicates it is possible to use parameters 
on an implementation mixin. At any rate, what would be the concept to 
achieving this, having the javascript hide/show event return an XHR 
request to the server that it in turn uses to set the persistent field?

Thanks,
Rich

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Implementation mixin and persistence

Posted by Rich M <ri...@moremagic.com>.
Amazing, thanks for the example here. My implementation isn't exactly 
the same, but your code example made the concept quite clear and I've 
got it working now. Thanks!

On 04/06/2011 01:14 PM, Taha Hafeez wrote:
> Dear Rich
>
> I tried to implement what you desired ( to the best of my understanding)
>
> this is it
>
> import org.apache.tapestry5.ClientElement;
> import org.apache.tapestry5.ComponentResources;
> import org.apache.tapestry5.Link;
> import org.apache.tapestry5.annotations.Environmental;
> import org.apache.tapestry5.annotations.Import;
> import org.apache.tapestry5.annotations.InjectContainer;
> import org.apache.tapestry5.annotations.Parameter;
> import org.apache.tapestry5.ioc.annotations.Inject;
> import org.apache.tapestry5.json.JSONObject;
> import org.apache.tapestry5.services.javascript.JavaScriptSupport;
>
> @Import(library = "show-hide.js")
> public class ShowHide {
>     @Parameter(required = true)
>     private boolean state;
>
>     @InjectContainer
>     private ClientElement element;
>
>     @Inject
>     private ComponentResources resources;
>
>     @Environmental
>     private JavaScriptSupport javaScriptSupport;
>
>     void afterRender(){
>        Link link = resources.createEventLink("showHide");
>        JSONObject spec = new JSONObject();
>        spec.put("url", link.toAbsoluteURI());
>        spec.put("id", element.getClientId());
>        spec.put("status", state);
>        javaScriptSupport.addScript("new ShowHide(%s);", spec);
>     }
>
>     void onShowHide(boolean state){
>        System.out.println("Old state = " + this.state + " new state = " +
> state);
>        this.state = state;
>     }
> }
>
> The javascript... (it is not doing anything fancy, just basic
> implementation)
>
> ShowHide = Class.create( {
>     initialize : function(spec) {
>        $(spec.id).status = spec.status;
>        Event.observe(spec.id, "click", function() {
>           if (!this.status) {
>              this.status = true;
>           } else {
>              this.status = !this.status;
>           }
>           Tapestry.ajaxRequest(spec.url + "/" + this.status, function() {
>              if($(spec.id).status){
>                 $(spec.id).show();
>              }else {
>                 $(spec.id).hide();
>              }
>           });
>        });
>     }
> });
>
>
> This is the component using this mixin as implementation mixin
>
> import net.jkbank.dc.ticket.mixins.ShowHide;
>
> import org.apache.tapestry5.BindingConstants;
> import org.apache.tapestry5.ClientElement;
> import org.apache.tapestry5.MarkupWriter;
> import org.apache.tapestry5.annotations.Environmental;
> import org.apache.tapestry5.annotations.Mixin;
> import org.apache.tapestry5.annotations.Parameter;
> import org.apache.tapestry5.services.javascript.JavaScriptSupport;
>
> public class Div implements ClientElement {
>     @Parameter(value = "prop:componentResources.id", defaultPrefix =
> BindingConstants.LITERAL)
>     private String clientId;
>
>     @SuppressWarnings("unused")
>     @Mixin
>     private ShowHide showHide;
>
>     private String assignedClientId;
>
>     @Environmental
>     private JavaScriptSupport javaScriptSupport;
>
>     void setupRender(){
>        assignedClientId = javaScriptSupport.allocateClientId(clientId);
>     }
>
>     void beginRender(MarkupWriter writer){
>        writer.element("div", "id", getClientId());
>     }
>
>     void afterRender(MarkupWriter writer){
>
>        writer.end();
>     }
>
>     public String getClientId() {
>        return assignedClientId;
>     }
>
> }
>
> This is the usage in a template file
>
> <html xmlns:t='http://tapestry.apache.org/schema/tapestry_5_1_0.xsd'>
>     <body>
>        <t:div t:state='state'>
>        This is some text
>        </t:div>
>     </body>
> </html>
>
> public class TestPage {
>     @Persist
>     @Property
>     private boolean state;
> }
>
>
> regards
> Taha
>
> On Wed, Apr 6, 2011 at 10:35 PM, LLTYK<LL...@mailinator.com>  wrote:
>
>> Last time I did this I used a javascript cookie api.
>>
>> --
>> View this message in context:
>> http://tapestry-users.832.n2.nabble.com/Implementation-mixin-and-persistence-tp6243796p6246820.html
>> Sent from the Tapestry Users 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: Implementation mixin and persistence

Posted by Taha Hafeez <ta...@gmail.com>.
Dear Rich

I tried to implement what you desired ( to the best of my understanding)

this is it

import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

@Import(library = "show-hide.js")
public class ShowHide {
   @Parameter(required = true)
   private boolean state;

   @InjectContainer
   private ClientElement element;

   @Inject
   private ComponentResources resources;

   @Environmental
   private JavaScriptSupport javaScriptSupport;

   void afterRender(){
      Link link = resources.createEventLink("showHide");
      JSONObject spec = new JSONObject();
      spec.put("url", link.toAbsoluteURI());
      spec.put("id", element.getClientId());
      spec.put("status", state);
      javaScriptSupport.addScript("new ShowHide(%s);", spec);
   }

   void onShowHide(boolean state){
      System.out.println("Old state = " + this.state + " new state = " +
state);
      this.state = state;
   }
}

The javascript... (it is not doing anything fancy, just basic
implementation)

ShowHide = Class.create( {
   initialize : function(spec) {
      $(spec.id).status = spec.status;
      Event.observe(spec.id, "click", function() {
         if (!this.status) {
            this.status = true;
         } else {
            this.status = !this.status;
         }
         Tapestry.ajaxRequest(spec.url + "/" + this.status, function() {
            if($(spec.id).status){
               $(spec.id).show();
            }else {
               $(spec.id).hide();
            }
         });
      });
   }
});


This is the component using this mixin as implementation mixin

import net.jkbank.dc.ticket.mixins.ShowHide;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Mixin;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;

public class Div implements ClientElement {
   @Parameter(value = "prop:componentResources.id", defaultPrefix =
BindingConstants.LITERAL)
   private String clientId;

   @SuppressWarnings("unused")
   @Mixin
   private ShowHide showHide;

   private String assignedClientId;

   @Environmental
   private JavaScriptSupport javaScriptSupport;

   void setupRender(){
      assignedClientId = javaScriptSupport.allocateClientId(clientId);
   }

   void beginRender(MarkupWriter writer){
      writer.element("div", "id", getClientId());
   }

   void afterRender(MarkupWriter writer){

      writer.end();
   }

   public String getClientId() {
      return assignedClientId;
   }

}

This is the usage in a template file

<html xmlns:t='http://tapestry.apache.org/schema/tapestry_5_1_0.xsd'>
   <body>
      <t:div t:state='state' >
      This is some text
      </t:div>
   </body>
</html>

public class TestPage {
   @Persist
   @Property
   private boolean state;
}


regards
Taha

On Wed, Apr 6, 2011 at 10:35 PM, LLTYK <LL...@mailinator.com> wrote:

> Last time I did this I used a javascript cookie api.
>
> --
> View this message in context:
> http://tapestry-users.832.n2.nabble.com/Implementation-mixin-and-persistence-tp6243796p6246820.html
> Sent from the Tapestry Users 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: Implementation mixin and persistence

Posted by LLTYK <LL...@mailinator.com>.
Last time I did this I used a javascript cookie api.

--
View this message in context: http://tapestry-users.832.n2.nabble.com/Implementation-mixin-and-persistence-tp6243796p6246820.html
Sent from the Tapestry Users 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: Implementation mixin and persistence

Posted by Rich M <ri...@moremagic.com>.
Thanks Josh, you are right. Using the Prototype Ajax.request object 
solved the problem (as it does include that header) and is easier to use 
anyway. Thanks for the tip.

On 04/06/2011 12:51 PM, Josh Canfield wrote:
>> When this is executed, it triggers the event method properly in the Java
>> Page class, but it also triggers the render cycle in the page class as well,
>> as far as my logs indicate.
> Sounds like tapestry isn't detecting that you are doing XHR. It's
> detected based on an HTTP header "X-Requested-With" set to
> "XMLHttpRequest". I believe this is supplied by jquery and prototype,
> not the base object provided by the browser.
>
>
> Josh
>
> On Wed, Apr 6, 2011 at 9:11 AM, Rich M<ri...@moremagic.com>  wrote:
>> To add, I'm not sure creating a pure XHR request is working out quite how I
>> might have expected. The following javascript snippet:
>>
>> var request = false;
>>         try {
>>           request = new XMLHttpRequest();
>>
>>           var url = "/ViewTransactionsTab:HideShow/" + escape(hide);
>>
>>           request.open("GET", url, true);
>>           request.send(null);
>>
>>         } catch (failed) {
>>           request = false;
>>         }
>>
>> and the Java Page class snippet:
>>
>> @Property @Persist
>>   private Boolean hide;
>>
>>   void onHideShow(boolean hidden){
>>
>>      debug("In onHideShow. Hidden: " + hidden);
>>
>>      hide = hidden;
>>   }
>>
>> When this is executed, it triggers the event method properly in the Java
>> Page class, but it also triggers the render cycle in the page class as well,
>> as far as my logs indicate. I don't believe this rendering is relayed to the
>> client, but it doesn't seem right either. This code was loosely based off of
>> http://tapestry.markmail.org/thread/fc2hubsb6dd6hait
>>
>> On 04/06/2011 11:49 AM, Rich M wrote:
>>> Thanks, that was an interesting read, but it doesn't help solve my
>>> problem. I still don't see how I would pass a persisted property-bound
>>> parameter to the implementation mixin. The only related code I've seen is
>>> like
>>>
>>> @Component(parameters={"hidden=hide"})
>>>
>>> but using that like this doesn't work for obvious reasons, since its a
>>> Mixin not a Component
>>>
>>> @Component(parameters={"hidden=hide"}) @Mixin("HideShowSearch")
>>>     private HideShowSearch hss;
>>>
>>>
>>>
>>> On 04/05/2011 08:51 PM, Taha Hafeez wrote:
>>>> Hi
>>>>
>>>> There was a discussion related to 'Parameters in Implementation
>>>> Mixins'...
>>>>
>>>> http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html
>>>>
>>>> Hope it helps
>>>>
>>>>
>>>> <http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html>
>>>> regards
>>>> Taha
>>>>
>>>> On Wed, Apr 6, 2011 at 2:22 AM, Rich M<ri...@moremagic.com>    wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have a Page and it has a search form, contained within an ID'ed DIV. I
>>>>> made an implementation mixin that initializes an Event observer on the
>>>>> on
>>>>> click event of a 'button' in the Page's HTML. The event triggers
>>>>> javascript
>>>>> that hides/shows the search form.
>>>>>
>>>>> That works fine, but I want to add functionality so there is persistence
>>>>> of
>>>>> the hide/show state between page refreshes. Documentation recommends to
>>>>> delegate persistence to the container using parameters, but I haven't
>>>>> seen
>>>>> any documentation that indicates it is possible to use parameters on an
>>>>> implementation mixin. At any rate, what would be the concept to
>>>>> achieving
>>>>> this, having the javascript hide/show event return an XHR request to the
>>>>> server that it in turn uses to set the persistent field?
>>>>>
>>>>> Thanks,
>>>>> Rich
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Implementation mixin and persistence

Posted by Josh Canfield <jo...@gmail.com>.
> When this is executed, it triggers the event method properly in the Java
> Page class, but it also triggers the render cycle in the page class as well,
> as far as my logs indicate.

Sounds like tapestry isn't detecting that you are doing XHR. It's
detected based on an HTTP header "X-Requested-With" set to
"XMLHttpRequest". I believe this is supplied by jquery and prototype,
not the base object provided by the browser.


Josh

On Wed, Apr 6, 2011 at 9:11 AM, Rich M <ri...@moremagic.com> wrote:
> To add, I'm not sure creating a pure XHR request is working out quite how I
> might have expected. The following javascript snippet:
>
> var request = false;
>        try {
>          request = new XMLHttpRequest();
>
>          var url = "/ViewTransactionsTab:HideShow/" + escape(hide);
>
>          request.open("GET", url, true);
>          request.send(null);
>
>        } catch (failed) {
>          request = false;
>        }
>
> and the Java Page class snippet:
>
> @Property @Persist
>  private Boolean hide;
>
>  void onHideShow(boolean hidden){
>
>     debug("In onHideShow. Hidden: " + hidden);
>
>     hide = hidden;
>  }
>
> When this is executed, it triggers the event method properly in the Java
> Page class, but it also triggers the render cycle in the page class as well,
> as far as my logs indicate. I don't believe this rendering is relayed to the
> client, but it doesn't seem right either. This code was loosely based off of
> http://tapestry.markmail.org/thread/fc2hubsb6dd6hait
>
> On 04/06/2011 11:49 AM, Rich M wrote:
>>
>> Thanks, that was an interesting read, but it doesn't help solve my
>> problem. I still don't see how I would pass a persisted property-bound
>> parameter to the implementation mixin. The only related code I've seen is
>> like
>>
>> @Component(parameters={"hidden=hide"})
>>
>> but using that like this doesn't work for obvious reasons, since its a
>> Mixin not a Component
>>
>> @Component(parameters={"hidden=hide"}) @Mixin("HideShowSearch")
>>    private HideShowSearch hss;
>>
>>
>>
>> On 04/05/2011 08:51 PM, Taha Hafeez wrote:
>>>
>>> Hi
>>>
>>> There was a discussion related to 'Parameters in Implementation
>>> Mixins'...
>>>
>>> http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html
>>>
>>> Hope it helps
>>>
>>>
>>> <http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html>
>>> regards
>>> Taha
>>>
>>> On Wed, Apr 6, 2011 at 2:22 AM, Rich M<ri...@moremagic.com>  wrote:
>>>
>>>> Hi,
>>>>
>>>> I have a Page and it has a search form, contained within an ID'ed DIV. I
>>>> made an implementation mixin that initializes an Event observer on the
>>>> on
>>>> click event of a 'button' in the Page's HTML. The event triggers
>>>> javascript
>>>> that hides/shows the search form.
>>>>
>>>> That works fine, but I want to add functionality so there is persistence
>>>> of
>>>> the hide/show state between page refreshes. Documentation recommends to
>>>> delegate persistence to the container using parameters, but I haven't
>>>> seen
>>>> any documentation that indicates it is possible to use parameters on an
>>>> implementation mixin. At any rate, what would be the concept to
>>>> achieving
>>>> this, having the javascript hide/show event return an XHR request to the
>>>> server that it in turn uses to set the persistent field?
>>>>
>>>> Thanks,
>>>> Rich
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: Implementation mixin and persistence

Posted by Rich M <ri...@moremagic.com>.
To add, I'm not sure creating a pure XHR request is working out quite 
how I might have expected. The following javascript snippet:

var request = false;
         try {
           request = new XMLHttpRequest();

           var url = "/ViewTransactionsTab:HideShow/" + escape(hide);

           request.open("GET", url, true);
           request.send(null);

         } catch (failed) {
           request = false;
         }

and the Java Page class snippet:

@Property @Persist
  private Boolean hide;

  void onHideShow(boolean hidden){

      debug("In onHideShow. Hidden: " + hidden);

      hide = hidden;
  }

When this is executed, it triggers the event method properly in the Java 
Page class, but it also triggers the render cycle in the page class as 
well, as far as my logs indicate. I don't believe this rendering is 
relayed to the client, but it doesn't seem right either. This code was 
loosely based off of http://tapestry.markmail.org/thread/fc2hubsb6dd6hait

On 04/06/2011 11:49 AM, Rich M wrote:
> Thanks, that was an interesting read, but it doesn't help solve my 
> problem. I still don't see how I would pass a persisted property-bound 
> parameter to the implementation mixin. The only related code I've seen 
> is like
>
> @Component(parameters={"hidden=hide"})
>
> but using that like this doesn't work for obvious reasons, since its a 
> Mixin not a Component
>
> @Component(parameters={"hidden=hide"}) @Mixin("HideShowSearch")
>     private HideShowSearch hss;
>
>
>
> On 04/05/2011 08:51 PM, Taha Hafeez wrote:
>> Hi
>>
>> There was a discussion related to 'Parameters in Implementation 
>> Mixins'...
>> http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html 
>>
>>
>> Hope it helps
>>
>> <http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html> 
>>
>> regards
>> Taha
>>
>> On Wed, Apr 6, 2011 at 2:22 AM, Rich M<ri...@moremagic.com>  wrote:
>>
>>> Hi,
>>>
>>> I have a Page and it has a search form, contained within an ID'ed 
>>> DIV. I
>>> made an implementation mixin that initializes an Event observer on 
>>> the on
>>> click event of a 'button' in the Page's HTML. The event triggers 
>>> javascript
>>> that hides/shows the search form.
>>>
>>> That works fine, but I want to add functionality so there is 
>>> persistence of
>>> the hide/show state between page refreshes. Documentation recommends to
>>> delegate persistence to the container using parameters, but I 
>>> haven't seen
>>> any documentation that indicates it is possible to use parameters on an
>>> implementation mixin. At any rate, what would be the concept to 
>>> achieving
>>> this, having the javascript hide/show event return an XHR request to 
>>> the
>>> server that it in turn uses to set the persistent field?
>>>
>>> Thanks,
>>> Rich
>>>
>>> ---------------------------------------------------------------------
>>> 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
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Implementation mixin and persistence

Posted by Rich M <ri...@moremagic.com>.
Thanks, that was an interesting read, but it doesn't help solve my 
problem. I still don't see how I would pass a persisted property-bound 
parameter to the implementation mixin. The only related code I've seen 
is like

@Component(parameters={"hidden=hide"})

but using that like this doesn't work for obvious reasons, since its a 
Mixin not a Component

@Component(parameters={"hidden=hide"}) @Mixin("HideShowSearch")
     private HideShowSearch hss;



On 04/05/2011 08:51 PM, Taha Hafeez wrote:
> Hi
>
> There was a discussion related to 'Parameters in Implementation Mixins'...
> http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html
>
> Hope it helps
>
> <http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html>
> regards
> Taha
>
> On Wed, Apr 6, 2011 at 2:22 AM, Rich M<ri...@moremagic.com>  wrote:
>
>> Hi,
>>
>> I have a Page and it has a search form, contained within an ID'ed DIV. I
>> made an implementation mixin that initializes an Event observer on the on
>> click event of a 'button' in the Page's HTML. The event triggers javascript
>> that hides/shows the search form.
>>
>> That works fine, but I want to add functionality so there is persistence of
>> the hide/show state between page refreshes. Documentation recommends to
>> delegate persistence to the container using parameters, but I haven't seen
>> any documentation that indicates it is possible to use parameters on an
>> implementation mixin. At any rate, what would be the concept to achieving
>> this, having the javascript hide/show event return an XHR request to the
>> server that it in turn uses to set the persistent field?
>>
>> Thanks,
>> Rich
>>
>> ---------------------------------------------------------------------
>> 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: Implementation mixin and persistence

Posted by Taha Hafeez <ta...@gmail.com>.
Hi

There was a discussion related to 'Parameters in Implementation Mixins'...
http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html

Hope it helps

<http://tapestry.1045711.n5.nabble.com/Parameters-in-implementation-mixins-td3395407.html>
regards
Taha

On Wed, Apr 6, 2011 at 2:22 AM, Rich M <ri...@moremagic.com> wrote:

> Hi,
>
> I have a Page and it has a search form, contained within an ID'ed DIV. I
> made an implementation mixin that initializes an Event observer on the on
> click event of a 'button' in the Page's HTML. The event triggers javascript
> that hides/shows the search form.
>
> That works fine, but I want to add functionality so there is persistence of
> the hide/show state between page refreshes. Documentation recommends to
> delegate persistence to the container using parameters, but I haven't seen
> any documentation that indicates it is possible to use parameters on an
> implementation mixin. At any rate, what would be the concept to achieving
> this, having the javascript hide/show event return an XHR request to the
> server that it in turn uses to set the persistent field?
>
> Thanks,
> Rich
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>