0

call a window with a button

asked 2013-09-24 14:25:22 +0800

daovallec gravatar image daovallec
11 2

updated 2014-03-06 17:18:58 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

I have this code:

 <?xml version="1.0" encoding="UTF-8"?>

    <zk>
        <style src="/widgets/grid/inline_row_editing/style.css" />
        <div apply="org.zkoss.bind.BindComposer"
         viewModel="@id('vm') @init('com.gemalto.segmentation.viewModel.users.InplaceEditingViewModel')"
    >

        <window id="MnoNEWin" title="Mnos" width="300px" visible="false" minimizable="true" border='normal'>
            <listbox id="listNE" model="@bind(each.mnoList)" >
                <listhead>
                    <listheader label="Mnos" sort="auto" />
                </listhead>
            </listbox>
        </window> 

        <grid id="demoGrid"
              model="@load(vm.languageContributions) @template((vm.displayEdit and each.editingStatus) ? 'editable' : 'noneditable')">
            <auxhead>
                <auxheader colspan="4"
                           label="Create Users">
                    <hlayout>
                        <label />
                        <button label="create" 
                                onClick="@command('onAddNew', languageContributionStatus=each)" />
                        <checkbox checked="@bind(vm.displayEdit)"
                                  label="Enable Multiple Inline Row Editing">
                        </checkbox>
                    </hlayout>
                </auxheader>
            </auxhead>

            <columns>
                <column width="160px">Email</column>
                <column width="160px">Password</column>
                <column width="160px">Confirm-Password</column>
                <column width="160px">Role</column>
                <column width="160px">Mnos</column>
                <column width="110px" visible="@load(vm.displayEdit)">Edit</column>
                <column width="110px" visible="@load(vm.displayEdit)">Remove</column>
            </columns>
            <rows>
                <template name="editable">
                    <row>
                        <textbox
                            value="@load(each.languageContribution.email) 
@save(each.languageContribution.email, before='confirm')" />
                        <textbox
                            value="@load(each.languageContribution.password) 
@save(each.languageContribution.password, before='confirm')" />      
                        <textbox
                            value="@load(each.languageContribution.password) 
@save(each.languageContribution.confirmPass, before='confirm')" />  
                        <textbox
                            value="@load(each.languageContribution.role) 
@save(each.languageContribution.role, before='confirm')" />


                        <button id="MnoE" label="Mnos"/>

                        <window id="MnoEWin" title="Mnos" width="300px" visible="false" minimizable="true" border='normal'>
                            <listbox id="listNE" model="@bind(each.mnoList)" >
                                <listhead>
                                    <listheader label="Mnos" sort="auto" />
                                </listhead>
                            </listbox>
                        </window> 

                        <button
                            label="save"
                            onClick="@command('confirm', languageContributionStatus=each)" />
                        <button
                            label="cancel"
                            onClick="@command('changeEditableStatus2', languageContributionStatus=each)" />


                    </row>
                </template>


                <template name="noneditable">
                    <row>
                        <label value="@load(each.languageContribution.email)" />
                        <label value="@load(each.languageContribution.password)" />
                        <label value="@load(each.languageContribution.password)" />
                        <label value="@load(each.languageContribution.role)" />

                        <button label="Mnos">
                            <attribute name="onClick"><![CDATA[
            if (!@load(each.languageContribution.email).isVisible())
                @load(each.languageContribution.email).setVisible(true);
            @load(each.languageContribution.email).doHighlighted();
        ]]></attribute>
                        </button>
                        <button
                            label="edit"
                            onClick="@command('changeEditableStatus', languageContributionStatus=each)" />

                        <window id="@load(each.languageContribution.email)"  title="Mnos" width="300px" visible="false" minimizable="true" border='normal'>
                            <listbox id="listNE" model="@bind(each.mnoList)" >
                                <listhead>
                                    <listheader label="Mnos" sort="auto" />
                                </listhead>
                            </listbox>
                        </window> 
                    </row>
                </template>
            </rows>


        </grid>
    </div>
    </zk>

And i have a problem because in the window

                    <button label="Mnos">
                        <attribute name="onClick"><![CDATA[
        if (!@load(each.languageContribution.email).isVisible())
            @load(each.languageContribution.email).setVisible(true);
        @load(each.languageContribution.email).doHighlighted();
    ]]></attribute>
                    </button>
                    <button
                        label="edit"
                        onClick="@command('changeEditableStatus', languageContributionStatus=each)" />

                    <window id="@load(each.languageContribution.email)"  title="Mnos" width="300px" visible="false" minimizable="true" border='normal'>
                        <listbox id="listNE" model="@bind(each.mnoList)" >
                            <listhead>
                                <listheader label="Mnos" sort="auto" />
                            </listhead>
                        </listbox>
                    </window>

I need that when click in button Mno the window:

<window id="@load(each.languageContribution.email)"

appear, but it window has an id for each user that i have, and o do not know how can i do for the button call the window, like a pop up, like:

http:  //www.  zkoss.  org/zkdemo/effects/login_effect
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-02-28 10:58:36 +0800

MVarun gravatar image MVarun flag of India
268 1 6

updated 2014-02-28 11:02:02 +0800

Hi daovallec,

To get the window as popup try this..

button.addEventListener("onClick", new EventListener() 
    {
        public void onEvent(Event evt)
        {
            window.doModal();
        }
    });

OR

In your zul page mention <window mode="modal"> </window>

here doModal() or modal is the Method to get popup.

Greetings..

M Varun.

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: 2013-09-24 14:25:22 +0800

Seen: 39 times

Last updated: Mar 06 '14

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