Saturday, 15 August 2015

grails - How to convert 2d array to 1d array to show in view -


I have data to see such a scene,

  ['Harry', [ I want to change them  
  ['Harry', 'Foo', 'Bar']  Code>  

Because when I gave them to look like this

  & lt; G: each var = "user" in = "$ {users}" gt; & Lt; Li & gt; $ {Username.name} & lt; / Li & gt; & Lt; / G: each & gt;  

The result will be shown

  • [Harry]
  • [foo, bar]
  • How can I do this? Thanks a lot.

    call .flatten () on your list, e.g. & lt; G: each var = "user" = "$ {users.flatten ()}" & gt; In (or better, you have to see the data in your controller before you have it)


    No comments:

    Post a Comment