1

I'm using fields plugins for grails and have a problem, when i scaffolding a domain class with an List of Strings as atribute class is showing like org.grails.datastore.mapping.dirty.checking.DirtyCheckingList class

List view

Here is my domain class

class Role {
 String id
 String role
 List<String> permissions

static constraints = {
 }
}

Also occurs in the others views as Show,

Show view

i would like customize the template to show the list of permissions in the table and the show view but i didn't found information about how to customize the template using the f:all tag and the f:table tag

Here is the index page

<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main" />
    <g:set var="entityName" value="${message(code: 'role.label', default: 'Role')}" />
    <title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
    <a href="#list-role" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
    <div class="nav" role="navigation">
        <ul>
            <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
            <li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
        </ul>
    </div>
    <div id="list-role" class="content scaffold-list" role="main">
        <h1><g:message code="default.list.label" args="[entityName]" /></h1>
        <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
    </g:if>
    <f:table collection="${roleList}" />

    <div class="pagination">
        <g:paginate total="${roleCount ?: 0}" />
    </div>
</div>
</body>
</html>

And the show page

<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main" />
    <g:set var="entityName" value="${message(code: 'role.label', default: 'Role')}" />
    <title><g:message code="default.show.label" args="[entityName]" /></title>
</head>
<body>
    <a href="#show-role" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
    <div class="nav" role="navigation">
        <ul>
            <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
            <li><g:link class="list" action="index"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
            <li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
        </ul>
    </div>
    <div id="show-role" class="content scaffold-show" role="main">
        <h1><g:message code="default.show.label" args="[entityName]" /></h1>
        <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
    </g:if>
    <f:display bean="role" />
        <g:each var="permission" in="${role.permissions}">
        <li>${permission}</li>
        </g:each>
<g:form resource="${this.role}" method="DELETE">
<fieldset class="buttons">
    <g:link class="edit" action="edit" resource="${this.role}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
    <input class="delete" type="submit" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
</fieldset>
</g:form>
</div>
</body>
</html>

1 Answers1

0

The <f:table> and <f:all> tags are provided by the Fields Plugin. You can find documentation for them here (this will soon be linked from the Grails docs) http://grails-fields-plugin.github.io/grails-fields/guide/introduction.html

You may need to customize the scaffolding templates to support what you're doing - I'm not sure the Fields plugin supports a List property that is not part of a hasMany. You can customize the templates by generating them (adding them to your project) as detailed here: https://grails.github.io/grails-doc/latest/ref/Command%20Line/install-templates.html

ZacharyAKlein
  • 633
  • 4
  • 9
  • I think that is a problem because i'm using mongodb for persistence, and sometimes i don't need the relationship `hasMany`, i tried to customize the templates but they use the same `` and `` tags, so i tried customize the field rendering [that explains here](http://grails-fields-plugin.github.io/grails-fields/guide/customizingFieldRendering.html) unsuccessfully – George Fisherman Apr 05 '16 at 14:47