Weird bug with native HTML and zk-if

Aaron Digulla 09/11/2018. 2 answers, 33 views
html-table zk

I'm trying to omit a table row when a boolean condition is false:

  <zk if="${vm.visible}">
    <n:tr>
      <n:td>
        <label value="Should be visible, too" />
      </n:td>
    </n:tr>
  </zk>

When visible is true, the following HTML is rendered:

  <tr>   </tr>

Why is that?

ZK Fiddle: http://zkfiddle.org/sample/3ikg0ch/3-Weird-bug-with-native-HTML-and-zk-if

The full ZUL:

<zk  xmlns:n="native">
  <window border="normal" title="hello" viewModel="@id('vm') @init('pkg$.TestComposer')">

    <div>
      visible=${vm.visible}
    </div>

    <n:table style="border: 1px solid green;">
      <n:tr>
        <n:td>
          <label value="Visible" />
        </n:td>
      </n:tr>
      <zk if="${vm.visible}">
        <n:tr>
          <n:td>
            <label value="Should be visible, too" />
          </n:td>
        </n:tr>
      </zk>
    </n:table>

    <n:table style="border: 1px solid red;">
      <n:tr>
        <n:td>
          <label value="Table 2" />
        </n:td>
      </n:tr>
      <zk if="${vm.hidden}">
        <n:tr>
          <n:td>
            <label value="Should be hidden" />
          </n:td>
        </n:tr>
      </zk>
    </n:table>
  </window>
</zk>

View model:

package pkg$;

import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zk.ui.ext.*;
import org.zkoss.zk.au.*;
import org.zkoss.zk.au.out.*;
import org.zkoss.zul.*;

public class TestComposer extends GenericForwardComposer{

  public boolean isVisible() {
    return true;
  }

  public boolean isHidden() {
    return false;
  }
}

2 Answers


Col 09/11/2018.

I'm surprised that doesn't work either but this does: (remove the enclosing zk if=... tag

<n:tr if="${vm.visible}">
  <n:td>
    <label value="Should be visible, too" />
  </n:td>
</n:tr>

cor3000 09/18/2018.

The official ZK issue is ZK-4055 and is supposed to be fixed in version 8.6.0

UPDATE: ZK-4055 has been fixed for 8.6.0 -> testable in 8.6.0.FL.20180917


HighResolutionMusic.com - Download Hi-Res Songs

1 Alan Walker

Different World flac

Alan Walker. 2018. Writer: Shy Nodi;Alan Walker;Fredrik Borch Olsen;James Njie;Marcus Arnbekk;Gunnar Greve Pettersen;K-391;Corsak;Shy Martin;Magnus Bertelsen.
2

Tell Me It's Over

3 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
4 Mesto

Wait Another Day flac

Mesto. 2018.
5 Anne-Marie

Rewrite The Stars flac

Anne-Marie. 2018. Writer: Benj Pasek;Justin Paul.
6 Rita Ora

Let You Love Me flac

Rita Ora. 2018. Writer: Rita Ora;Easyfun;Fred Gibson;Noonie Bao;LotusIV;Ilsey Juber.
7 Conor Maynard

How You Love Me flac

Conor Maynard. 2018. Writer: Yoshi Breen;Thom Bridges;Hardwell;Rik Annema;Conor Maynard;Cimo Fränkel;Snoop Dogg.
8 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
9 ZAYN

There You Are flac

ZAYN. 2018. Writer: Joe Garrett;Levi Lennox;Michael Hannides;Anthony Hannides;ZAYN.
10 (G)I-DLE

POP/STARS flac

(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
11 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
12 Bastille

Grip flac

Bastille. 2018. Writer: Dan Smith;Espen Berg;Joakim Haukaas;Mark Crew;Simen Eriksrud;Thomas Eriksen.
13 Ariana Grande

Imagine flac

Ariana Grande. 2018. Writer: Jameel Roberts;Priscilla Renea;Happy Perez;Andrew "Pop" Wansel;Ariana Grande.
14 Mark Ronson

Nothing Breaks Like A Heart flac

Mark Ronson. 2018. Writer: Thomas Brenneck;Maxime Picard;Ilsey Juber;Conor Szymanski;Clement Picard;Mark Ronson;Miley Cyrus.
15 ZAYN

Good Years flac

ZAYN. 2018. Writer: Anthony Hannides;Khaled Rohaim;Michael Hannides;ZAYN;Herbie Crichlow.
16 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
17 Clean Bandit

Mama flac

Clean Bandit. 2018. Writer: Jason Evigan;Jack Patterson;Grace Chatto;Ellie Goulding;Caroline Ailin.
18 Halsey

Without Me (Illenium Remix) flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
19 Martin Garrix

Dreamer (Nicky Romero Remix) flac

Martin Garrix. 2018. Writer: Yury Parkhomenko;Aleksandr Parkhomenko;Ilsey Juber;Brian Lee;Mike Yung;Martin Garrix.
20 Julian Jordan

Glitch flac

Julian Jordan. 2018.

Related questions

Hot questions

Language

Popular Tags