0

Groupbox state testing with JQuery

asked 2012-01-16 13:24:36 +0800

m17 gravatar image m17
39

Hi All,

I am trying to test a ZK (5.0.6) application using JQuery client-side scripting.
It works fine until I try to test if a groupbox is open or closed. This is (simplified) my page:

<groupbox closable="true" open="false">
        <caption image="myimage.png" label="mylabel"/>
        <listbox>
            ... content...
	</listbox>   
</groupbox>

I try to check if the listbox inside the groupbox is visible by using the ZK extensions to jq to locate the elements and then applying the :visible selector.
So my jq selector string is

@groupbox @listbox:visible 

And I expect it to return null if groupbox is closed and the listbox element if the groupbox is open. But in practice it always finds the groupbox.

I tried looking inside the generated HTML using DOM Inspector and analysing the css that implements the hiding. I see some CSS overflow:hidden manipulations but my JS knowledge is not enough to understand them completely. Anyway, JQ selector :visible is said to work fine with such cases as it checks if "browser-reported offsetWidth or offsetHeight is greater than 0.

Any idea what is the problem ?

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-01-17 07:42:59 +0800

TonyQ gravatar image TonyQ
642
https://www.masterbranch....

I want to suggest you to use ZK Widget API .

Here's the example.

ZKFiddle-Link

index.zul
<zk xmlns:w="client">
<groupbox closable="true" open="false">
<caption label="mylabel"/>
<div>
content
</div>
</groupbox>

<button label="click me to know the open state of groupbox." w:onClick="alert(zk.Widget.$(jq('@groupbox')[0]).isOpen())" />
</zk>

You could find ZK JS doc in ZK website.
http://www.zkoss.org/javadoc/latest/jsdoc/

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: 2012-01-16 13:24:36 +0800

Seen: 290 times

Last updated: Jan 17 '12

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