0

Open a popup within Client Side Action (Javascript)

asked 2009-01-19 12:56:04 +0800

robertpic71 gravatar image robertpic71
1275 1

I need some helppictures (more than icons) for the selection from comboboxes, listitems. I found a very fast way for onmouseover-action.
However, CSA can only enable the view form a popup. But the first time view from the popup has to be from the serverside (position).

Is there a way to do "popup.open(Component)" in CSA? Meanwhile i use serverside-action to open the popup the first time.

Here is a small demo, build with the zkdemo-pictures:

<hbox>
        <zscript>
     void openCombo(OpenEvent event) {
          if (event.isOpen()) { 
             help.open(dummy);
             // real life: set image from the selected item
          } else {
             help.close();
          }
     }
</zscript> 
        <button label="test" action="onmouseover: #{test}.src='/zkdemo/img/Centigrade-Widget-Icons/GoldBar-32x32.gif';"/>
        Combobox with description and icons:
	<combobox onOpen="openCombo(event)">
		<comboitem label="Simple and Rich" action="onmouseover: window.action.show(#{help}); #{helpsrc}.src='/zkdemo/img/Centigrade-Widget-Icons/GoldBar-32x32.gif'; onmouseout: window.action.hide(#{help})" />
			<comboitem label="Cool!"
                                action="onmouseover: window.action.show(#{help}); #{helpsrc}.src='/zkdemo/img/Centigrade-Widget-Icons/CogwheelEye-32x32.gif'; onmouseout: window.action.hide(#{help})"   />
			<comboitem label="Ajax and RIA"
                                action="onmouseover: window.action.show(#{help}); #{helpsrc}.src='/zkdemo//img/Centigrade-Widget-Icons/WindowGlobe-32x32.gif'; onmouseout: window.action.hide(#{help})"  />
		</combobox>
         <label id="dummy"/>
         <popup id="help">
               <image id="helpsrc" src="" height="150px" width="150px"/>
         </popup>    
</hbox>	

Maybe a zero-tooltiptime only for one page is an alternative.

BTW: This works also for iframe (i.e. html help)
BTW2: I use a converter to setup the CSA-Action, like
<comboitem label="@{product.description}"
action="@{product.picture, converter='com.at.od.MouseHelpImage'" />

/Robert

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2009-01-21 01:18:20 +0800

robertlee gravatar image robertlee
561

hi Robert,

You can use the comm utility provided by ZK to fire Client side event towards the Server, see this post for a dirty workaround:

http://zkoss.org/forum/index.zul#path%3DlistComment%3BdiscussionId%3D6532%3BcategoryId%3D14%3B

Regards,
Robert

link publish delete flag offensive edit

answered 2009-01-21 02:05:53 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

cool customization on combobox, :).

link publish delete flag offensive edit

answered 2009-01-21 04:39:01 +0800

robertpic71 gravatar image robertpic71
1275 1

Hi Robert (Lee),

thanks for your answer. i hoped for a client-side-only resolution (without server-roundtrip). However, the speed seems ok. Fire the first open from the server and the changes at clientside is fast enough. With your workaround i could avoid the empty popup at the first time.

@dennis
thanks, i need many (help) pictures and html-help. I think my application will be "on air" next week (for betatesting) - i've also done some other image-prompters.

/Robert

link publish delete flag offensive edit

answered 2009-01-21 04:41:58 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

Would you post the url of the application, so we can 'play' it also ? :)

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2009-01-19 12:56:04 +0800

Seen: 687 times

Last updated: Jan 21 '09

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