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 Elohim

Holding Hands flac

Elohim. 2019. Writer: Quinn XCII;Jeremy Zucker;Elohim;Danny Parra;Corey Berkowitz;Antonina Armato.
2 P!nk

Walk Me Home flac

P!nk. 2019. Writer: P!nk;Scott Harris;Nate Ruess.
3 Katy Perry

365 flac

Katy Perry. 2019. Writer: Zedd;Katy Perry;Caroline Ailin;Corey Sanders;Daniel Davidsen;Cutfather;Peter Wallevik.
4 DEAMN

Happy flac

DEAMN. 2019.
5 Ariana Grande

7 Rings flac

Ariana Grande. 2019. Writer: Ariana Grande;Richard Rodgers;TBHits;Njomza;Michael "Mikey" Foster;Kaydence;Tayla Parx;Scootie;Oscar Hammerstein II;Victoria Monét.
6 5 Seconds Of Summer

Who Do You Love flac

5 Seconds Of Summer. 2019. Writer: Andrew Taggart;Talay Riley;Oak;Sean Douglas;Luke Hemmings;Calum Hood;Ashton Irwin;Michael Clifford;Trevorious;Zaire Koalo.
7 Bonn

No Sleep flac

Bonn. 2019. Writer: Albin Nedler;Bonn;Martin Garrix.
8 Bruno Mars

Please Me flac

Bruno Mars. 2019. Writer: J. White Did It;DJ White Shadow;Philip Lawrence;Bruno Mars;Cardi B.
9 Brooks

Better When You're Gone flac

Brooks. 2019. Writer: David Guetta;Emma Lov Block;Ido Zmishlany;Jackson Foote;Jeremy Dussolliet;Brooks.
10 Ariana Grande

Imagine flac

Ariana Grande. 2019. Writer: JProof;Priscilla Renea;Happy Perez;Andrew "Pop" Wansel;Ariana Grande.
11 Avril Lavigne

Dumb Blonde flac

Avril Lavigne. 2019. Writer: Mitch Allan;Bonnie McKee;Nicki Minaj;Avril Lavigne.
12 Avril Lavigne

Birdie flac

Avril Lavigne. 2019. Writer: J.R. Rotem;Avril Lavigne.
13 Ariana Grande

Thank U, Next flac

Ariana Grande. 2019. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
14 Ariana Grande

Fake Smile flac

Ariana Grande. 2019. Writer: Joseph Frierson;Mary Frierson;Fred Ball;Happy Perez;Andrew "Pop" Wansel;Wendy Rene;Kennedi Lykken;Priscilla Renea;Justin Tranter;Ariana Grande.
15 Avril Lavigne

Warrior flac

Avril Lavigne. 2019. Writer: Chad Kroeger;Travis Clark;Chris Baseford;Avril Lavigne.
16 Nichkhun

Home flac

Nichkhun. 2019.
17 Dua Lipa

Swan Song flac

Dua Lipa. 2019. Writer: Dua Lipa;Justin Tranter;Kennedi Lykken;Mattias Larsson;Robin Fredriksson;Junkie XL.
18 Dimitri Vegas & Like Mike

Selfish flac

Dimitri Vegas & Like Mike. 2019. Writer: Victor Thell;Michael Thivaios;Maria Smith;Jeff Porcaro;Dimitri Thivaios;David Paich;Dan Book;Will Grands;ANGEMI.
19 Jason Derulo

Let's Shut Up And Dance flac

Jason Derulo. 2019. Writer: Bongo.
20 Ariana Grande

Needy flac

Ariana Grande. 2019. Writer: Tayla Parx;TBHits;Victoria Monét;Ariana Grande.

Related questions

Hot questions

Language

Popular Tags