SpaceTrucker
SpaceTrucker

Reputation: 13556

Why is zk rendering a second tbody for a listbox?

I'm having a problem where zk 3.6.3 is rendering a second <tbody> tag for a Listbox. Actually the first rendered <tbody> tag is the one that is making me problems. It has it's css style set to visibility:hidden;height:0px and Opera 12 and IE 11 are rendering a large white empty space for it. So in the browser I see the table header, this empty space and then the actual rows of the listbox.

The problematic code for zkoss rendering is contained in org.zkoss.zkmax.zul.render.ListboxDefault in lines 53-63.

How can I prevent zkoss or browsers from rendering this empty space?

Upvotes: 0

Views: 283

Answers (2)

Aaron Digulla
Aaron Digulla

Reputation: 328624

The first tbody contains the list header (no, I don't know why they don't use thead for this). If you don't add one to the list, the CSS visibility:hidden;height:0px should make it invisible on the screen and that works for me.

My guess is that somewhere in the app, you have CSS rules which override this style. So the next step is to fire up the web developer tools and check which CSS styles are actually applied.

Alternatively, you can give the list box a custom class setSclass("hiddenheader") and then use CSS like this:

table.hiddenheader tbody:first-child { display: none; }

(note: I didn't test this; ZK might add some prefix to the styles so you might have to adjust the code but the example should get you started).

Upvotes: 1

chillworld
chillworld

Reputation: 4277

Well, there is always a solution and maybe the "hacking" solution is the best here :

Class overriding of that class.

  1. Create that package and create that class (exactly the same package and classname).
  2. Copy the code from your link to your class.
  3. Change the code, I'll suggest try to remove the complete if. => See what result it gives (test al your listboxes!)
  4. When you ever think of upgrading ZK version : Don't forget to remove or update the class !!!

If removing doesn't help, try to change the style,...

On the other hand, if updating ZK version is possible, you should try that.
The version you use is old, and doesn't support newer browsers.

Upvotes: 2

Related Questions