List in gsp

classic Classic list List threaded Threaded
3 messages Options
js
Reply | Threaded
Open this post in threaded view
|

List in gsp

js
Hello , I need a help . I want to show list in gsp table . The list is as follows 

student = [[students.StdAsgn : 1, students.StdAsgn : 2, students.StdAsgn : 3], [students.StdAsgn : 4, students.StdAsgn : 5, students.StdAsgn : 6]]

which is send to the template as render(template:'studentList' ,model: [std:students])'
and got the list in table using g:each as 
<g:each var="s" in="${std}">
    <tr>
<td>${s[0].student.stdName}</td>
<td>${s[0].student.stdEmail}</td>
<td>${s[0].student.phNum}</td>
<td>${s.assignment.aName}</td>
<td>${s.student}</td>
<td>${s.status}</td>
</tr>
</g:each>

and the table shown in is as follows :
Showing 1 to 2 of 2 entries

 

but i want to get table in the following ways.
NameEmailPhone NoAssignment NameURLAction
Sagar Budhathoki[hidden email]1234567890C Programming Assignment, 
Assignment 1
 asgn 3
students.Student : 1
students.Student : 1
students.Student : 1
false
 false 
false
Kabita Oli[hidden email]987654321C Programming Assignment
Assignment 1
asgn 3
students.Student : 2
students.Student : 2
students.Student : 2
false
 false
 false

 How to divide one into multiple rows using grails  


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/d9a88447-b9f9-4b2a-85cb-07d5a6ef6b52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: List in gsp

NGUYEN Vu Ngoc Tung
Hello,It's not a big deal. Your problem could be resolved by using
${s[0].student.phNum}
$
{String.join("<br/>", s.assignment.aName)}
$
{String.join("<br/>", s.student)}
$
{String.join("<br/>", s.status)}


Please reference to another detailed discussion about  How to join array elements with a separator.

Have a good luck!
T. Nguyen

On Wednesday, 5 September 2018 12:46:24 UTC+1, Jagriti Srivastava wrote:
Hello , I need a help . I want to show list in gsp table . The list is as follows 

student = [[students.StdAsgn : 1, students.StdAsgn : 2, students.StdAsgn : 3], [students.StdAsgn : 4, students.StdAsgn : 5, students.StdAsgn : 6]]

which is send to the template as render(template:'studentList' ,model: [std:students])'
and got the list in table using g:each as 
<g:each var="s" in="${std}">
    <tr>
<td>${s[0].student.stdName}</td>
<td>${s[0].student.stdEmail}</td>
<td>${s[0].student.phNum}</td>
<td>${s.assignment.aName}</td>
<td>${s.student}</td>
<td>${s.status}</td>
</tr>
</g:each>

and the table shown in is as follows :
NameEmailPhone NoAssignment NameURLAction
Sagar Budhathoki<a href="javascript:" target="_blank" gdf-obfuscated-mailto="mSMlYXnfBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">s...@...1234567890[C Programming Assignment, Assignment 1, asgn 3][students.Student : 1, students.Student : 1, students.Student : 1][false, false, false]
Kabita Oli<a href="javascript:" target="_blank" gdf-obfuscated-mailto="mSMlYXnfBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">k...@...0987654321[C Programming Assignment, Assignment 1, asgn 3][students.Student : 2, students.Student : 2, students.Student : 2][false, false, false]
Showing 1 to 2 of 2 entries

 

but i want to get table in the following ways.
NameEmailPhone NoAssignment NameURLAction
Sagar Budhathoki<a href="javascript:" target="_blank" gdf-obfuscated-mailto="mSMlYXnfBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">s...@...1234567890C Programming Assignment, 
Assignment 1
 asgn 3
students.Student : 1
students.Student : 1
students.Student : 1
false
 false 
false
Kabita Oli<a href="javascript:" target="_blank" gdf-obfuscated-mailto="mSMlYXnfBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">k...@...987654321C Programming Assignment
Assignment 1
asgn 3
students.Student : 2
students.Student : 2
students.Student : 2
false
 false
 false

 How to divide one into multiple rows using grails  


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/7c681cd2-f33c-4972-b317-55fa76ed2f48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
js
Reply | Threaded
Open this post in threaded view
|

Re: List in gsp

js
Thank you so much .

On Thu, Oct 4, 2018 at 6:20 PM NGUYEN Vu Ngoc Tung <[hidden email]> wrote:
Hello,It's not a big deal. Your problem could be resolved by using
${s[0].student.phNum}
$
{String.join("<br/>", s.assignment.aName)}
$
{String.join("<br/>", s.student)}
$
{String.join("<br/>", s.status)}


Please reference to another detailed discussion about  How to join array elements with a separator.

Have a good luck!
T. Nguyen

On Wednesday, 5 September 2018 12:46:24 UTC+1, Jagriti Srivastava wrote:
Hello , I need a help . I want to show list in gsp table . The list is as follows 

student = [[students.StdAsgn : 1, students.StdAsgn : 2, students.StdAsgn : 3], [students.StdAsgn : 4, students.StdAsgn : 5, students.StdAsgn : 6]]

which is send to the template as render(template:'studentList' ,model: [std:students])'
and got the list in table using g:each as 
<g:each var="s" in="${std}">
    <tr>
<td>${s[0].student.stdName}</td>
<td>${s[0].student.stdEmail}</td>
<td>${s[0].student.phNum}</td>
<td>${s.assignment.aName}</td>
<td>${s.student}</td>
<td>${s.status}</td>
</tr>
</g:each>

and the table shown in is as follows :
NameEmailPhone NoAssignment NameURLAction
Sagar Budhathoki[hidden email]1234567890[C Programming Assignment, Assignment 1, asgn 3][students.Student : 1, students.Student : 1, students.Student : 1][false, false, false]
Kabita Oli[hidden email]0987654321[C Programming Assignment, Assignment 1, asgn 3][students.Student : 2, students.Student : 2, students.Student : 2][false, false, false]
Showing 1 to 2 of 2 entries

 

but i want to get table in the following ways.
NameEmailPhone NoAssignment NameURLAction
Sagar Budhathoki[hidden email]1234567890C Programming Assignment, 
Assignment 1
 asgn 3
students.Student : 1
students.Student : 1
students.Student : 1
false
 false 
false
Kabita Oli[hidden email]987654321C Programming Assignment
Assignment 1
asgn 3
students.Student : 2
students.Student : 2
students.Student : 2
false
 false
 false

 How to divide one into multiple rows using grails  


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/7c681cd2-f33c-4972-b317-55fa76ed2f48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAEohGSbz23DCB6u8%3DAUUa2Xw%2B43H11QJenn_35y3h_aq1dvX4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.