javascript - how to make layout work in grails when link has id (or not) -
the following code in land.gsp page.
<table style="padding: 10 "> <thead> <tr style="color: blue"> <td>gname</td> <td>gowner</td> <td>device number</td> <td>edit </td> <td>delete </td> </tr> </thead> <tbody> <g:each in="${groups.list()}" status="i" var="groupsinstance"> <g:set var="myid" value="${groupsinstance.id}"></g:set> <tr class="${(i % 2) == 0 ? 'even' : 'odd'}"> <td>${fieldvalue(bean: groupsinstance, field: "gname")}</td> <td>${fieldvalue(bean: groupsinstance, field: "gowner")}</td> <td>${fieldvalue(bean: groupsinstance, field: "devicenum")}</td> <td><g:link action="edit" id="${groupsinstance.id}">edit</g:link></td> <td><g:link action="deleteme" id="${groupsinstance.id}">delete</g:link></td> </tr> </g:each> </tbody> </table>
but when click on edit layout of page not working( javascript, images, styles). id passed edit.gsp page correctly. when change
<td><g:link action="edit" id="${groupsinstance.id}">edit</g:link></td>
to
<td><g:link action="edit" >edit</g:link></td>
that without passing id , clicking on edit give page correct layout. following edit action
def edit(long id) { def groupsinstance = groups.get(id) if (!groupsinstance) { flash.message = message(code: 'default.not.found.message', args: [message(code: 'groups.label', default: 'groups'), id]) redirect(action: "list") return } [groupsinstance: groupsinstance] }
where went wrong? want pass id edit page correct layout.
try view source html in browser, might give clue wrong.
Comments
Post a Comment