-1

Outlook style search box [closed]

asked 2012-07-16 12:57:03 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2615 3 8
http://emrpms.blogspot.in...

Hi

I am trying to implement outlook style search box, where by default one field will be shown to search, and also when we expand, it will show additional fields.
Can this implemented using any of ZK Component

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by Senthilchettyin
close date 2013-03-20 19:30:30

3 Replies

Sort by ยป oldest newest

answered 2012-09-13 09:06:13 +0800

paowang gravatar image paowang
140 6

How about Groupbox with open="false" ?
http://books.zkoss.org/wiki/ZK_Component_Reference/Containers/Groupbox

link publish delete flag offensive edit

answered 2013-03-20 19:19:45 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2615 3 8
http://emrpms.blogspot.in...

I am able to achieve same kind of behavior using group box. But only thing i could not able to stop open and close when the user click on the bar of the group box.

I have given open and close at the right corner, so i want to expand and close only by clicking this button. If user press on the bar of the group box, nothing should happen. How we can stop this expand and collapse when user press on the bar ?

Here is the code.

<zk>
<window width="100%" apply="zkView.Example6">
    <separator></separator>
    <groupbox id="grpbox" width="100%" mold="3d">
        <attribute name="onOpen"><![CDATA[
arrow1.setSclass("open-" + self.isOpen());

]]></attribute>

<label value="Patient Code"></label> <textbox></textbox>
<toolbarbutton id="openClose" label="Open"/>
<vbox> <label value="Advance Search goes here"></label> </vbox> </groupbox>

</window>

</zk>

package zkView;

import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Groupbox; import org.zkoss.zul.Messagebox; import org.zkoss.zul.Toolbarbutton;

public class Example6 extends GenericForwardComposer { private Groupbox grpbox; private Toolbarbutton openClose;

public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);
    grpbox.setClosable(false);
    grpbox.setOpen(false);
}

public void onClick$openClose()
{

    grpbox.setClosable(true);
    if (grpbox.isOpen()==true)
    {
        grpbox.setOpen(false);
        openClose.setLabel("Open");
    }
    else
    {
        grpbox.setOpen(true);
        openClose.setLabel("Close");
    }


}

}

link publish delete flag offensive edit

answered 2013-03-20 19:30:09 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2615 3 8
http://emrpms.blogspot.in...

I got it.

Here is the modified controller

package zkView;

import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Groupbox; import org.zkoss.zul.Toolbarbutton;

public class Example6 extends GenericForwardComposer { private Groupbox grpbox; private Toolbarbutton openClose;

public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);
    grpbox.setClosable(false);
    grpbox.setOpen(false);
    grpbox.addEventListener("onMyEvent", new EventListener(){
        @Override
        public void onEvent(Event arg0) throws Exception {
             System.out.println("The onClick event is fired");
             grpbox.setClosable(false);
        }

    });
}

public void onClick$openClose()
{

    grpbox.setClosable(true);
    if (grpbox.isOpen()==true)
    {
        grpbox.setOpen(false);
        openClose.setLabel("Open");
    }
    else
    {
        grpbox.setOpen(true);
        openClose.setLabel("Close");
    }

    Events.echoEvent("onMyEvent", grpbox, null);
}

}

link publish delete flag offensive edit

Question tools

Follow

RSS

Stats

Asked: 2012-07-16 12:57:03 +0800

Seen: 131 times

Last updated: Mar 20 '13

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