Mvvm ZK:在Client.showNotification中显示绑定值
我正在使用MVVM aproach处理一个ZK项目,我试图做的是显示@bind(each.info)值的通知,但它似乎不适合我,以下是我到目前为止所做的Mvvm ZK:在Client.showNotification中显示绑定值,mvvm,zk,Mvvm,Zk,我正在使用MVVM aproach处理一个ZK项目,我试图做的是显示@bind(each.info)值的通知,但它似乎不适合我,以下是我到目前为止所做的 <div width="59%" style=" float: left !important;" apply="org.zkoss.bind.BindComposer" viewModel="@id('menu') @init('ma.schlemmer.headerbar.mainMenu')"> <hl
<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>
谢谢您可以使用ZK命令来完成此操作。您应该得到您想要的结果,如下所示:
<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="@command('showInfo', obj=each, comp=self)"></a>
</template>
</hlayout>
您没有提供足够的代码,因此我无法测试确切的情况,但基本上您需要将每个对象(我猜这类似于ListMenu对象)和组件传递给命令。然后,您可以轻松地显示通知
致以最良好的祝愿,
奥斯瓦尔达斯
@Command
public void showInfo(@BindingParam("obj") ListMenu listMenu, @BindingParam("comp") Component comp) {
Clients.showNotification(listMenu.getInfo(),"warning",comp,"after_center",1000);
}