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 AJR

Birthday Party flac

AJR. 2019. Writer: Adam Met;Jack Met;Ryan Met;Peter Ivers;David Lynch.
2 Loote

Your Side Of The Bed flac

Loote. 2018. Writer: ​Jesse Saint John;Jackson Foote;Emma Lov Block.
3 AJR

100 Bad Days flac

AJR. 2019. Writer: Jack Met;Adam Met;Ryan Met.
4 Joe Jonas

Longer Than I Thought flac

Joe Jonas. 2018. Writer: Patrick Nissley;Jackson Foote;Dave Katz.
5 Loote

Out Of My Head flac

Loote. 2018. Writer: Emma Lov Block;Michael Pollack;Jeremy Dussolliet;Jackson Foote.
6 Iselin Solheim

Anyone Out There flac

Iselin Solheim. 2019. Writer: Iselin Solheim;Max Grahn.
7 Loote

Wish I Never Met You flac

Loote. 2018. Writer: Jackson Foote;Alex Peter Koste;Jeremy Dussolliet;Emma Lov Block.
8 Kim Petras

Heart To Break flac

Kim Petras. 2018. Writer: Cirkut;Aaron Joseph;Dr. Luke;Jacob Kasher;Kim Petras.
9 A L E X

Out On The Trampoline At Night flac

A L E X. 2018. Writer: A L E X.
10 A L E X

I Want To Hold Your Hand flac

A L E X. 2018. Writer: A L E X.
11 A L E X

Field flac

A L E X. 2018. Writer: A L E X.
12 A L E X

Save Me flac

A L E X. 2018. Writer: A L E X.
13 Devin

Summer Lover flac

Devin. 2019. Writer: Tommy Lee James;Stuart Crichton;Oliver Heldens;Nile Rodgers;Devin Guisande.
14 A L E X

9 To 5 flac

A L E X. 2018. Writer: A L E X.
15 A L E X

Skirt flac

A L E X. 2018. Writer: A L E X.
16 Florian Picasso

Midnight Sun (Extended Version) flac

Florian Picasso. 2019.
17 Florian Picasso

Midnight Sun flac

Florian Picasso. 2019.
18 21 Savage

Enzo flac

21 Savage. 2019. Writer: YungLunchBox;Sheck Wes;Offset;Gucci Mane;21 Savage;DJ Snake.
19 Tales Of Ratatösk

Battle Of The Doomed Gods 320kbps

Tales Of Ratatösk. 2019.
20 Tales Of Ratatösk

Andro 320kbps

Tales Of Ratatösk. 2019.

Related questions

Hot questions

Language

Popular Tags