Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4536

Turn a text into an HTML element only

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 9.0.0
    • None

      Use Case

      A text in a zul is turned into a Label component.

      <zk>
      mylabel
      </zk>
      

      EL expression ${page} is also in the same situation.

      In most cases, application developers don't intend to change such static text value dynamically since they write in a pure text.
      The Label is largely used in almost every page e.g. in a form, the label for an input field doesn't change dynamically. Even there are only 5 labels on a page, but 100 users visit the same page will produce 5*100 unnecessary label components.

      drawback

      • if no dynamically change is needed, it's a waste of memory.

      alternative

      The native element like <n:span class="z-label">mylabel</n:span> can do the same work but it's more inconvenient.

      Proposed Solution

      turn the text into an HTML span, no Label Java component and Label widget, neither. Still apply z-label to keep the consistent style as ZK <label>.

      <span class='z-label'>mylabel<span>
      

      Consider to create a library property to determine such text conversion behavior ( to a Label or HTML span only)

      This solution could cause a back-compatibility issue, if you find it, please list it.

      advantage

      1. save both server and client memory

            Unassigned Unassigned
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: