Grails Sortable Column Issue

Tags: , ,

 class Role implements Serializable {
    // this is my domain class
    private static final long serialVersionUID = 1

    String authority

    Role(String authority) {
        this.authority = authority

    static constraints = {
        authority blank: false, unique: true

    static mapping = {
        cache true

def indexList(){

        render(template: "indexList", model:[roleInstanceList: Role.findAll()])
    }   // this is the method in the controller that renders the view page 'indexList'



   <div class="col-md-12 main-header">Role List</div>
   //this is my 'view' gsp page to be rendered 
   <table class="table manage-table">
            **<g:sortableColumn property="authority"
                title="${message(code: 'role.authority.label', default: 'authority')}" />**
        <g:each in="${roleInstanceList}" status="i" var="roleInstance">
            <tr id="${}" class="${(i % 2) == 0 ? 'even' : 'odd'}">

                    ${fieldValue(bean: roleInstance, field: "authority")}

Here, when I click on Sortable Column ‘authority’ – sorting is not done and I am getting a page refresh with the following URL: role/indexList?sort=authority&order=asc Any help much appreciated. Thanks and a note to point that I am new to grails framework


You probably want Role.list(params) instead of Role.findAll().

Source: stackoverflow