【问题标题】:event.stopPropagation in MinimizeEvent not working in zk 7.1MinimizeEvent 中的 event.stopPropagation 在 zk 7.1 中不起作用
【发布时间】:2014-10-07 06:12:55
【问题描述】:

这是我的代码

<window id="chatW" border="none" mode="overlapped"
    viewModel="@id('vm') @init('zul.chat.chattest.ChatController')"
    binder="@init(queueScope='application')"
    minimizable="true"
    onClick="@command('showChat')"
    title="${labels.conversation }" apply="org.zkoss.bind.BindComposer"
    onMinimize="@command('minimize')">
</window>

Controller中的minimize方法

    @Command("minimize")
    @NotifyChange("minimizedWindow")
    public void minimize(
            @ContextParam(ContextType.TRIGGER_EVENT) MinimizeEvent event) {
        System.out.println("in minimize event" + event);
        event.stopPropagation();
    }

当我点击最小化按钮窗口消失。我怎样才能阻止这个事件?

【问题讨论】:

    标签: events binding zk stoppropagation


    【解决方案1】:

    您必须添加一个按钮才能返回窗口,请参见下面的代码

    <?page title="new page title" contentType="text/html;charset=UTF-8"?>
    <zk>
        <window  height="100%" width="100%" border="normal">
    
        <panel id="panel" title="Panel" framable="true" height="400px" width="700px"
            maximizable="true" minimizable="true"  border="normal" collapsible="true" closable="true">
    
            <panelchildren>       
            <tabbox >
                <tabs>
                    <tab label="Find"></tab>
                    <tab label="Result"></tab>
                </tabs>
                <tabpanels>
                    <tabpanel>
                        <grid id="OwnerMultipleGrd" 
                            mold="paging" pageSize="5" style="align:top;">
                            <columns>
                                <column align="center" width="25px">
                                    <checkbox></checkbox>
                                </column>
                                <column align="center">Taxonomy</column>
                                <column align="center">Asset Type</column>
                                <column align="center">Category</column>
                                <column align="center">Sub-Category</column>
                                <column align="center" width="25px">
                                    <image id="AddTaxononomyImg"
                                        src="/AMContribution/Icons/Add.png">
                                    </image>
                                </column>
                            </columns>                      
                        </grid>
                    </tabpanel>
    
                    <tabpanel>
                        <grid id="demoGrid" 
                            mold="paging" pageSize="5" style="align:top;">                      
                            <auxhead>
                                <auxheader width="25px">                            
                                </auxheader>
                                <auxheader >
                                    <image
                                        src="/TaxonomyManager/Icons/funnel.png" />
                                    <textbox id="filter1" width="100px" />
                                </auxheader>
                                <auxheader >
                                    <image
                                        src="/TaxonomyManager/Icons/funnel.png" />
                                    <textbox id="filter2" width="100px" />
                                </auxheader>
                                <auxheader >
                                    <image
                                        src="/TaxonomyManager/Icons/funnel.png" />
                                    <textbox id="filter3" width="100px" />
                                </auxheader>
                                <auxheader >
                                    <image
                                        src="/TaxonomyManager/Icons/funnel.png" />
                                    <textbox id="filter4" width="100px" />
                                </auxheader>                            
                            </auxhead>
                            <columns>                           
                                <column width="25px"><checkbox></checkbox> </column>
                                <column>Taxonomy</column>
                                <column>Asset Type</column>
                                <column>Category</column>
                                <column>Sub-Category</column>                           
                            </columns>                      
                        </grid>
                        <div align="center">
                        <button>Submit</button> <button>Cancel</button>
                        </div>
    
                    </tabpanel>
                </tabpanels>
            </tabbox>
             </panelchildren>
        </panel>
        <button label="restore">
            <attribute name="onClick">
                panel.setMinimized(false);
            </attribute>
        </button>
        </window>
    </zk>
    

    【讨论】:

    • 我需要阻止此事件,因为我想将此按钮用于其他事情。
    • 你的意思是最小化按钮不会最小化窗口吗?
    • 是的。因为我不希望那个窗口最小化,我只是调整窗口大小
    【解决方案2】:

    最小化效果必须在客户端停止,因为最小化效果不受服务器控制。
    看看here.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-14
      • 1970-01-01
      相关资源
      最近更新 更多