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.
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:
> 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.
On Wednesday, 16 May 2012 01:42:58 UTC+10, David Whittaker wrote:
> 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:
>> 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.
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:
> 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
> On Wednesday, 16 May 2012 01:42:58 UTC+10, David Whittaker wrote:
>> 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:
>>> 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.
> 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:
>> 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
>> On Wednesday, 16 May 2012 01:42:58 UTC+10, David Whittaker wrote:
>>> 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:
>>>> 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.
> 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:
>> 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:
>>> 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
>>> On Wednesday, 16 May 2012 01:42:58 UTC+10, David Whittaker wrote:
>>>> 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:
>>>>> 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.