Hi I am trying to make a dynamically created drop down list in grails that emphasizes only certain option tags. Here is what I have:
<g:select class="DropDownList"
from="${listOfMaps}"
optionValue="${{(it.match=='Something'?'<em>':'') + it.thingToPrint
+ (it.match=='Something'?'</em>':'') }}"
/>
and this works in the sense that it will print the thing to print, but when it is suppose to add the <em> tag it prints it like this:
<option><em>ITEM</em></option>
And that is not what I need. that prints <em>ITEM</em> in the drop down list.
Does anyone know how to get it to be this instead:
<option><em>ITEM</em></option>
so that it will print ‘ITEM‘ ?
The resources that I have used thus far:
The
<g:select/>tag html encodes values returned from the optionValue attribute, that is why your html is getting escaped.The best way to do this is to write a custom taglib, however, even then you’ll probably want to do this with CSs instead of markup since CSS styling of an
<option>tag is probably more broadly supported.