I have to render a dinamic number of elements depending on some rules determined in the snippet. After that I need to react to user interaction in any of this rendered elements. To determine what element is the one that fired the event I decided to read the id of the element.
Eg. Snippet
def render = list.view.zipwithindex.map( case (value,index) => "*" #> <button id="{index}">{value}<button>)
To get something like this:
<button id="1">One</button>
<button id="2">Two</button>
<button id="3">Three</button>
The problem is that what I’m getting is something like this:
<button id="{index}">One</button>
<button id="{index}">Two</button>
<button id="{index}">Three</button>
What’s wrong? I have tested using single quotes, double quotes, scaping using “””{index}””” and nothing works.
Just as an extra, moving the id as this is a good way of proceeding or theres a fancier way to achieve this using lift?
Thanx!
Just avoid the quotes completely.