Difference between revisions of "Template:CustomItemRendering"

From Documentation
(Created page with "= Custom Item Rendering = Since this component has no child component like <code>Listbox</code>, if you want to render its items differently, there 2 ways: == Change text ==...")
 
Line 6: Line 6:
  
 
<syntaxhighlight line lang='xml'>
 
<syntaxhighlight line lang='xml'>
        <template name="model">[${each}]</template>
+
<{{{1}}}>
 +
    <template name="model">[${each}]</template>
 +
</{{{1}}}>
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 03:55, 5 December 2023

Custom Item Rendering

Since this component has no child component like Listbox, if you want to render its items differently, there 2 ways:

Change text

If you just want to change the text e.g. enclosing it with brackets, just put <template> as its child and add characters with ${each}:

1 <{{{1}}}>
2     <template name="model">[${each}]</template>
3 </{{{1}}}>
  • The template only allows text that can be converted into a ZK Label.

Change HTML Structure

If you want to make more changes e.g. adding tooltips by setting title attributes, you need to create your own ItemRenderer. See ZK Developer's Reference/MVC/View/Renderer/Item Renderer.