Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Is it possible to define a function to be called when a MenuItem is selected?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jonathan Ferguson  
View profile  
 More options May 15 2012, 3:00 am
From: Jonathan Ferguson <j...@spiralarm.com>
Date: Tue, 15 May 2012 00:00:21 -0700 (PDT)
Local: Tues, May 15 2012 3:00 am
Subject: Is it possible to define a function to be called when a MenuItem is selected?

Hello all,
   I have a custom Loc in which I override supplimentalKidMenuItems to
build a sub menu based on a database table.  Ideally when a MenuItem from
the sub menu is clicked a function would be run allowing me to change
state.  Currently I'm stuck and am thinking about using a RestHelper to
trigger the state change, which seems ugly.

   override def supplimentalKidMenuItems =  CurrentUser.is match{

      case Full(u) =>

        val ts = u.things

        ts.size match {

          case 1 => Nil  

          case otherwise =>

            val x = for { t <- ts}  yield {MenuItem(Text(t.name.is), Text(
"switch/%s".format(t.id)), Nil, false, false,Nil)}

            x.toList ::: super.supplimentalKidMenuItems

        }

      case otherwise => Nil

      }
Any pointers would be appreciated.

Thank you
Jono


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Whittaker  
View profile  
 More options May 15 2012, 11:42 am
From: David Whittaker <d...@iradix.com>
Date: Tue, 15 May 2012 11:42:58 -0400
Local: Tues, May 15 2012 11:42 am
Subject: Re: [Lift] Is it possible to define a function to be called when a MenuItem is selected?

Hi Jono,

What type of state are we talking about?  Does your code need to run when
the menu item is clicked, or can it be invoked when the page the menu item
points to is displayed?

On Tue, May 15, 2012 at 3:00 AM, Jonathan Ferguson <j...@spiralarm.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Ferguson  
View profile  
 More options May 15 2012, 6:18 pm
From: Jonathan Ferguson <j...@spiralarm.com>
Date: Tue, 15 May 2012 15:18:48 -0700 (PDT)
Local: Tues, May 15 2012 6:18 pm
Subject: Re: [Lift] Is it possible to define a function to be called when a MenuItem is selected?

Hi David,

The code needs to run when the menu item is clicked. So the new state is
available to the snippets when the page is being built.

Jono


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Whittaker  
View profile  
 More options May 15 2012, 6:39 pm
From: David Whittaker <d...@iradix.com>
Date: Tue, 15 May 2012 18:39:18 -0400
Local: Tues, May 15 2012 6:39 pm
Subject: Re: [Lift] Is it possible to define a function to be called when a MenuItem is selected?

Jono,

Could you not accomplish that through a type safe Loc that calculates a
value?  Maybe this doesn't fit your particular use case but I'm thinking
that a Loc[State] where the the State is calculated via a CalcValue
LocParam would make the State available to the snippets when the Loc is
matched.  You can then define your snippets as:

class MySnippet(val state: State) extends DispatchSnippet {
..... some transforms that use your state .....

}

On Tue, May 15, 2012 at 6:18 PM, Jonathan Ferguson <j...@spiralarm.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Ferguson  
View profile  
 More options May 22 2012, 9:40 pm
From: Jonathan Ferguson <j...@spiralarm.com>
Date: Wed, 23 May 2012 11:40:10 +1000
Local: Tues, May 22 2012 9:40 pm
Subject: Re: [Lift] Is it possible to define a function to be called when a MenuItem is selected?

Hi David,

Sorry for the delay, I got caught up with another project.

I think this could be a viable solution. Do you know where there is
anything documentation on type safe Loc and LocParam other than the scala
docs?

I'll have a look at the scala doc and see if I can get an example working.

Thank you

Jono

On 16 May 2012 08:39, David Whittaker <d...@iradix.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Whittaker  
View profile  
 More options May 23 2012, 9:29 am
From: David Whittaker <d...@iradix.com>
Date: Wed, 23 May 2012 09:29:05 -0400
Local: Wed, May 23 2012 9:29 am
Subject: Re: [Lift] Is it possible to define a function to be called when a MenuItem is selected?

Hi Jono,

There is some info in Exploring Lift:
http://exploring.liftweb.net/master/index-7.html#toc-Subsection-7.6.2 and
HarryH from Foursquare put together some slides on how they use them a
while back: https://docs.google.com/present/view?id=dcbpz3ck_38cj3kdbgm.
 Hope that helps.

-Dave

On Tue, May 22, 2012 at 9:40 PM, Jonathan Ferguson <j...@spiralarm.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »