Search code examples
grailsgrails-pluginscaffolding

Why does Grails Scaffolding plugin limits the amount of displayed properties?


I am using Grails 2.4.2 and the scaffolding plugin 2.1.2 and noticed that dynamic scaffolding does only display up to 6 properties of a domain class in the index.gsp. The index.gsp contains a line like this.

props.eachWithIndex { p, i ->
    if (i < 6) { 
       if (p.isAssociation()) { %>
<th><g:message code="${domainClass.propertyName}.${p.name}.label" default="${p.naturalName}" /></th>
<%      } else { %>
<g:sortableColumn property="${p.name}" title="\${message(code: '${domainClass.propertyName}.${p.name}.label', default: '${p.naturalName}')}" />
<%  }   }   }

So the question is why is this limitation and why is it hard coded? Should not it be configurable? Is the limitation bound to the default layout main.gsp?


Solution

  • The reason why it's limited like that is to prevent creating a list page that has so many fields returned in it that it's unusable.

    Secondly, it is configurable. You can install the templates and change it. Or you can generate the view and edit the gsp.

    However, I suspect you are asking why can't you define this as something within the domain class or project and not have to do either of the above. I'd say fork the plugin, add that ability, and make a pull request.