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<rich...@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<rich...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



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


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


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



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

Reply via email to