1

ZK :Show Bind value in Client.showNotification

asked 2014-05-23 14:05:21 +0800

elmetni gravatar image elmetni
145 7

m working on a ZK project using MVVM aproach , what i m trying to do is to show notification of a @bind(each.info) value but is not seems to work with me , here s what i have done so far.

<div width="59%"  style=" float: left !important;" apply="org.zkoss.bind.BindComposer"
  viewModel="@id('menu') @init('ma.schlemmer.headerbar.mainMenu')">


    <hlayout children="@bind(menu.listMenu)">
            <template name="children">
                     <a  iconSclass="@bind(each.icon)"  href="@bind(each.link)" autag="@bind(each.info)" onRightClick='Clients.showNotification("@bind(each.info)" ,"warning",this.self,"after_center",1000)'></a>
             </template>
     </hlayout>
</div>

and thank you

delete flag offensive retag edit

Comments

@cyiannoulis : thank you so much it works just perfectectly

elmetni ( 2014-05-23 16:09:03 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-05-23 15:16:23 +0800

cyiannoulis gravatar image cyiannoulis
1201 10

updated 2014-05-23 15:19:51 +0800

The declaration

onRightClick='Clients.showNotification("@bind(each.info)" ,"warning",this.self,"after_center",1000)'

is invalid because the EL expression "@bind(each.info)" cannot be parsed dynamically during the execution.

You can do this easily using a @command attribute:

<hlayout children="@bind(menu.listMenu)">
 <template name="children">
  <a iconSclass="@bind(each.icon)"  
    href="@bind(each.link)"
    label="@bind(each.label)"
    onRightClick="@command('showInfo', menuOption=each, parent=self)">
  </a>
 </template>
</hlayout>

and inside your view model implement the command:

@Command("showInfo")
public void onShowInfo(@BindingParam("menuOption") Menubean option,  @BindingParam("parent") Component parent) {
  Clients.showNotification(option.getInfo(), "warning", parent, "after_center", 1000);
}

Hope that helps

Costas

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-05-23 14:05:21 +0800

Seen: 30 times

Last updated: May 23 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More