Revision history [back]

click to hide/show revision 1
initial version

asked 2012-08-24 11:02:29 +0800

sjoshi gravatar image sjoshi flag of India

http://zkframeworkhint.bl...

Issue Implemeting Interesting Macro Component ?

Hi Please help me to resolve this issue.

The Scenario is something like this:- 1- I have created a Macro Component Containing Two ListBox(Left and Right) with a button->mymacrocomponent.zul- ---Done

<zk>
     <hlayout
        style="padding-left: 40px;padding-top:20px;padding-bottom:20px;"
        hflex="1" vflex="1">
        <separator ></separator>

        <listbox id="leftListbox" height="250px" width="250px"
            onDrop="move(event.dragged)" droppable="true" oddRowSclass="non-odd"
            model="${arg.model}">
            <listhead>
                <listheader label="Default Columns" ></listheader>
            </listhead>
            <template name="model" var="each">
                <listitem draggable="true" droppable="true"
                    onDrop="move(event.dragged)">
                    <listcell label="${each}" ></listcell>
                </listitem>
            </template>
        </listbox>

        <separator orient="vertical" spacing="20px" ></separator>

        <listbox id="rightListbox" height="250px" width="250px"
            onDrop="move(event.dragged)" droppable="true"
            oddRowSclass="non-odd">
            <listhead>
                <listheader label="Selected Columns" ></listheader>
            </listhead>
        </listbox>

    </hlayout>

    <button onClick="@command('updatelist')" type="button" label="Save"  id="myButton"></button>

    <zscript><![CDATA[
    void move(Component dragged) {
        if (self instanceof Listitem) {
            self.parent.insertBefore(dragged, self);
        } else {
            self.appendChild(dragged);
        }
    }
]]></zscript>
</zk>

2-I Added this macro Component to another zul file[my_listBox.zul] :-Done

<?component name="refreshListbox" macroURI="/my_macro_component.zul" inline="true"?>
<zk>

    <window apply="org.zkoss.bind.BindComposer"
        viewModel="@id('vm') @init('org.test.TestVM')" width="100%"
        height="100%">

        <button onClick="@command('showModelPopUp')" label="ShowMacro"></button>

        <listbox model="@load(vm.model)" emptyMessage="Empty List"
            itemRenderer="@load(vm.itemRenderer)">

            <listhead children="@load(vm.headerList)">
                <template name="children" var="headerName">
                    <listheader label="@load(headerName)"></listheader>
                </template>
            </listhead>


        </listbox>
        <window title="MacroComponent" id="queryWindow" height="80%"
            width="54%" mode="modal" position="center" closable="true"
            visible="@load(vm.showModelWindow)" popup="true">

            <refreshListbox model="@load(vm.headerList)" height="100%"
                width="100%">
            </refreshListbox>

        </window>
    </window>
</zk>

3-When User will click on this button* ShowMacro* I opened a Model Window and Shoe Two ListBox in which one list box have data which is coming from ModelViewClass.:-Done

Now Issue is that 4-I want When User will click on the Save button of Macro Component , then ListBox of [my_listBox.zul] file will refresh and data populate again I do not understand How can I achieve this.

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