I haven't really used Ajax much but it seems to me there are two kinds of 
changes.
1. Modifying the view, e.g., clicking an emal in Gmail, or Expand All. One can 
make an analogy to a GET request, in that there's no permanent change.
2. Taking actions, e.g., invoking an action on the server, or deleting the 
viewed email in Gmail. The analogy would be to a POST.
It seems to me that Lift's Ajax is often used for #2. However backbutton 
support doesn't really make sense in that scenario.


-------------------------------------
Alex Boisvert<alex.boisv...@gmail.com> wrote:

Just thinking out loud as to how this could work...

On modern browsers, it's possible to monitor the state change of the
browser's URL hash (aka window.location.hash /  '#' / document fragment) in
the browser with the 'onhashchange' DOM event.  It gets fired whenever the
location.hash changes.  On older browsers, it's also possible to poll for
change which is less efficient but that's life.

So the idea would be to:

1) add a snippet or utility method to set up a listener on onhashchange that
would callback Scala functions associated with given hash (e.g. #foo, #bar,
...).  Hashes could support parameters too (e.g., #foo/:param1/:param2)

2) add a method S.ajaxHash(hashPath, callback): JsCmd that would bind a hash
path/pattern to a Scala function (by registering the path/pattern with the
listener)

3) add a method S.changeHash(hashPath, params): JsCmd to programmatically
change the browser's hash as a result of some AJAX processing.

I don't have time to work on this yet but I'd be happy to hear what others
think of the idea.

alex

On Wed, Jan 13, 2010 at 2:45 PM, greekscala <hellectro...@gmail.com> wrote:

> Hello,
>
> I would really would like to have this type of support from lift.
> I looked at GWT and think this is a nice way. They use url parameters
> after a '#'. I dont understand the process because I have very little
> javascript knowledge.
>
> But I am thinking, lift is creating unique function names and is
> calling them with ajax.
> Maybe there is a way to have the functions be called over a way like
> GWT?
>
> Just creating some thoughts...
>
> best regards
>
>
> On 12 Jan., 13:23, greekscala <hellectro...@gmail.com> wrote:
> > Hello Timothy,
> >
> > there is nothing stoping me from using it.
> > But when I think of a framework it would be nice to "activate"
> > backbutton support.
> > I think this is somethink a lot of people would appreciate to have and
> > not everybody
> > should have to build this from the ground up.
> >
> > I do not have to deal with this now but in near future. I will have to
> > search
> > what ways are avalable. And if I can intergrate this im my app, maybe
> > we
> > can find a way to abstract it.
> >
> > with best regards
> >
> > On 12 Jan., 00:35, Timothy Perrett <timo...@getintheloop.eu> wrote:
> >
> > > I'm not sure what is stopping you using something like this in
> > > conjunction with lift?
> >
> > > If you want something baked in, can you be specific with what and how
> > > you might want it to work?
> >
> > > Cheers, Tim
> >
> > > Sent from my iPhone
> >
> > > On 11 Jan 2010, at 23:13, greekscala <hellectro...@gmail.com> wrote:
> >
> > > > Hello Alex!
> >
> > > > I will take a look at sammy.js .
> > > > I would like to have some way for this in Lift too.
> > > > Since with Lift it is easy to do alot of ajax.
> >
> > > > with best regards
> >
> > > > On 11 Jan., 23:05, Alex Boisvert <alex.boisv...@gmail.com> wrote:
> > > >> I've been playing with sammy.js <http://code.quirkey.com/sammy/>
> > > >> recently
> > > >> and I like the way they update the URL fragment identifier (hash)
> > > >> when doing
> > > >> AJAX which makes apps more back-button friendly, in a manner that's
>
> > > >> similar
> > > >> to GMail.
> >
> > > >> It would be nice to have something similar in Lift.
> >
> > > >> alex
> >
> > > >> On Mon, Jan 11, 2010 at 4:55 PM, greekscala
> > > >> <hellectro...@gmail.com> wrote:
> > > >>> Hello Lift people!
> >
> > > >>> I would like to know how experienced lift devs think and what they
>
> > > >>> do
> > > >>> about
> > > >>> ajax backbutton support.
> >
> > > >>> with best regards
> >
> > > >>> --
> > > >>> You received this message because you are subscribed to the Google
>
> > > >>> Groups
> > > >>> "Lift" group.
> > > >>> To post to this group, send email to lift...@googlegroups.com.
> > > >>> To unsubscribe from this group, send email to
> > > >>> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> <liftweb
> > > >>> %2bunsubscr...@googlegroups.com>
> > > >>> .
> > > >>> For more options, visit this group at
> > > >>>http://groups.google.com/group/liftweb?hl=en.
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Lift" group.
> > > > To post to this group, send email to lift...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> > > > .
> > > > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en
> > > > .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to