Grails tagLib each loop -
i'm trying index value on each loop around through taglib. example: rough dummy code.
data.each() { item -> def index out << "<option value='${item.name}'>item.name</option>" }
so data array of objects. i'm after trying index of each item in each loop.
this easy accomplish using eachwithindex
data.eachwithindex { item, idx -> out << "<option value='${item.name}'>${item.name} - ${idx}</option>" }
Comments
Post a Comment