Item node property
Description
:ItemNode it is found only inside list items. It is used by the website editor to identify the list items so users can interact with
them more easily.
This flag it is also used to add mouse interactions, such as:
- remove image/slide,
- update image/slide,
- move up or down in hierarchy,
- duplicate image or slide - users can add new slides this way
When the user is updating the Image of the slide, the app is looking for :ItemNode and replace it with the new value. If your slider is
rendering the slides as html nodes like li, div etc and it saves data in these nodes or saves the nodes internally, you might want to set
the :ItemNode flag inside of these nodes, because they will be replaced by the updated ones and they will loose the data or loose
the node reference.
{object:BaseObject}
{block:List}
{:ItemNode}
{/block:List}
{/object:BaseObject}
Example of how :ItemNode is used:
The :ItemNode here is used to mark the html node as the root html element used to get all the mouse events, as well as to create
the list items. The li is used by the slider plugin to create the slides, while the div is used as the holder of the slide
content. The content can be replaced without disturbing the slider node reference.
<ul>
{block:ImageListItem itemCount="3"}
<li class="imagebg" data-overlay="4">
<div {:ItemNode}>
<div class="background-image-holder">
<img alt="image" src="{:ImageUrl defaultValue='images/editor/cover10.jpg'}">
</div>
<div class="container pos-vertical-center">
<div class="row">
<div class="col-sm-12 text-center">
<h1>{:Title}</h1>
<div class="lead">
{:Description}
</div>
</div>
</div>
</div>
</div>
</li>
{/block:ImageListItem}
</ul>
Warning!!
It is very important to set the :ItemNode flag in the correct html node,
otherwise the list items will not be created properly and the user will not be able to interact with them as expected.
Do not set the :ItemNode flag in the html node in the next node after block:ImageListItem, like in the example below:
...
...
<li class="imagebg" data-overlay="4">
...
...
Set it up inside the element that is holding the list item.
One way to acheve this is to set the :ItemNode flag in an element that is only holding the node:
<ul>
{block:ImageListItem itemCount="3"}
<li class="imagebg" data-overlay="4">
<div {:ItemNode} class="only_as_holder"></div>
<div>
<div class="background-image-holder">
<img alt="image" src="{:ImageUrl defaultValue='images/editor/cover10.jpg'}">
</div>
<div class="container pos-vertical-center">
<div class="row">
<div class="col-sm-12 text-center">
<h1>{:Title}</h1>
<div class="lead">
{:Description}
</div>
</div>
</div>
</div>
</div>
</li>
{/block:ImageListItem}
</ul>