Hi I have a grails variable which is of type JASONList that is rendered in a template
Is there a way to access this list from inside a javascript function.
Lets say I want onresize to fit all the objects on the screen. Without making a db call and re fetching the entire list from ajax ....
Lets say the template does something like this
<g:each var="report" in="${reportList?.myArrayList}">
<li style="display:inline; list-style:none;">
<img src=" ${report?.img}">
</li>
</g:each>
<script type="text/javascript">
function resize(list){
if(list.size <givenSize) //posudo code
list.subList() // psudocode
}
window.onresize = resize("${reportList}")
</script>
The problem with this is that for some reason grails gsp does not render "${reportList}" as a list instead it renders it as the string "${reportList}"
I am probably thinking of this problem completely wrong but is there a way to resize these objects or get them through document.getElementById or something of that nature ...
EDIT: the $reportList is populated by POJO as JSON convertion ...