mercredi 4 janvier 2017

How to load table dynamically on the checkbox value in gsp

I am working on a table in gsp which i want to load dynamically on a checkbox value.. I need if the checkbox is unchecked than the table will show the following fields

Name  age country status
Tom   35  USA     Confirm
Nick  30  USA     ready
Alex  25  Canada  Inprogress
Johny 20  UK      Waiting

and if the checkbox is checked it will show all the fields

Name  age country status
Tom   35  USA     Confirm
Nick  30  USA     ready
Alex  25  Canada  Inprogress
Johny 20  UK      Waiting
Dipu  22  USA
Jack  22  UK

I am using the following code

   <g:each in="${domainInstanceList}" status="i" var="domainInstance">
                <%

                     //color = "#ff4d4d"
                     color = "#FF6868"
                   def  name = domainInstance?.name
                   def  age= domainInstance?.age
                    def country= domainInstance?.country

                    if (domainInstance.isConfirm) {
                        //color = "#b3ccff"
                        color = "#56B9CC"
                        status = "Confirmed"
                    }
                    if(domainInstance.isReady){
                           status = "Ready"
                    }else if(domainInstance.inProgress ){
                        status = "Inprogress"
                    }else if(domainInstance.iswaiting  ){
                        status = "Waiting"
                    }


                %>

                <tr style="background-color:${color}" class="${(i % 2) == 0 ? 'even' : 'odd'}">
                        <td><b><g:link action="show" id="${domainInstance?.id}">${domainInstance?.prefix}${domainInstance?.number}</g:link></td></b></td>

                        <td>${name}
                        <td>${age}
                        <td>${country}
                        <td>${status}

                </tr>               
            </g:each>

Please help me
thanks




Aucun commentaire:

Enregistrer un commentaire