Giter Site home page Giter Site logo

easygrid's People

Contributors

kendoig avatar sbglasius avatar stokito avatar truongngoctuan avatar tudor-malene avatar uehaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easygrid's Issues

Filters not working for Double, Float, Long types

Hi Tudor,

Filters are not working for Double, Float and Long types, I changed the EasygridConfig filterClosure from int to other types for domain,gorm and List. It does not fix.

//default search closures for different column types
number = { filter -> eq(filter.filterable.name, filter.paramValue as Long) }
// from int to Long and column to filterable as in issue #17

I had to add filterClosure at column level to make the filters working.

Please suggest if a global setting can fix this.

EasyGrid 1.4.3

Thank you.

Question - Default sort order change to desc

Hi Tudor,

Is there any setting in Easygrid to change the default sort order of the grid. I tried it in domain and it does not work.

static mapping = {
sort([ invDate:'desc',invNo:'asc'])
}

Thank you.

Column Filter for Integer datatype

Hi Tudor, thanks for all your help. I came across another issue when using Integer datatype with the column filter (at bottom of data column) with datatables. My code in the controller in the grid definition is:

columns {   
            age {
                enableFilter true
                formatName 'nrToString'
            }
}

The domain contains age defined as:

Integer age

When I enter a filter term under the age column I get no results even if there is a value matching the age e.g. enter 32 and it stays processing even if there is an entry with age 32. I notice the field/filter is reacting to each keystroke. Is there something I must do to handle the Integer datatype correctly for the column filters? Thank you.

Unable to use "list" as datasource

I am unable to use the dataSourceType of "list".

I am using version 1.4.1 of the plugin with grails 2.3.4.

I am receiving the following error. My gsp and controller code is listed below.

No such property: list for class: org.grails.plugin.easygrid.datasource.ListDatasourceService
Possible solutions: class. Stacktrace follows:
Message: No such property: list for class: org.grails.plugin.easygrid.datasource.ListDatasourceService
Possible solutions: class
Line | Method
->> 40 | list in org.grails.plugin.easygrid.datasource.ListDatasourceService


| 77 | callDSList in org.grails.plugin.easygrid.EasygridDispatchService
| 83 | gridData . in org.grails.plugin.easygrid.EasygridService
| 64 | doCall in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2_closure10_closure12
| 187 | guard . . in org.grails.plugin.easygrid.EasygridService
| 103 | doCall in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2_closure10_closure17_closure18
| 191 | doFilter . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run . . . in java.lang.Thread

gsp:

Controller:

def personListjqGrid = {
dataSourceType 'list'
context 'session'
attributeName 'people'
enableFilter false
inlineEdit false

    columns {
        id {
            jqgrid {
                hidden true
            }
        }
        lastName    {
            label 'Last Name'
            jqgrid {
                resizable false
            }
        }
        emailAddress    {
            label 'Email'
            jqgrid {
                resizable false
                width 300
            }
        }
    }
}

def index() {
session.people = Person.list()
render view: 'testEasyGrid'
}

Upgrade Grails 2.2.4 -> 2.3.2 causes 'type' error on initialization

I recently upgraded my application from Grails v2.2.4 to v2.3.2 with easygrid plugin at v1.4.1 The controller and grid code remained the same. However on first accessing the page with the grid I encounter the following error:

| Error 2013-11-13 04:20:51,844 [localhost-startStop-1] ERROR easygrid.EasygridInitService  - Failed to initialize grid: vehicleOfInterest
Message: Cannot get property 'type' on null object
    Line | Method
->>  219 | getPropertyType             in org.grails.plugin.easygrid.GridUtils
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    108 | doCall                      in org.grails.plugin.easygrid.datasource.GormDatasourceService$_addDefaultValues_closure6
|    100 | addDefaultValues . . . . .  in org.grails.plugin.easygrid.datasource.GormDatasourceService
|     65 | callDSAddDefaultValues      in org.grails.plugin.easygrid.EasygridDispatchService
|    334 | addDefaultValues . . . . .  in org.grails.plugin.easygrid.EasygridInitService
|    168 | initializeFromClosureMethod in     ''
|    157 | doCall . . . . . . . . . .  in org.grails.plugin.easygrid.EasygridInitService$_initControllerGrids_closure5
|    155 | initControllerGrids         in org.grails.plugin.easygrid.EasygridInitService
|     45 | doCall . . . . . . . . . .  in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2
|     43 | initializeGrids             in org.grails.plugin.easygrid.EasygridInitService
|     53 | doCall . . . . . . . . . .  in EasygridGrailsPlugin$_closure3
|    334 | innerRun                    in java.util.concurrent.FutureTask$Sync
|    166 | run . . . . . . . . . . . . in java.util.concurrent.FutureTask
|   1145 | runWorker                   in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                         in java.lang.Thread
| Error 2013-11-13 04:20:51,887 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Failed to initialize grid: vehicleOfInterest.
Message: Failed to initialize grid: vehicleOfInterest.
    Line | Method
->>  171 | initializeFromClosureMethod in org.grails.plugin.easygrid.EasygridInitService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    157 | doCall                      in org.grails.plugin.easygrid.EasygridInitService$_initControllerGrids_closure5
|    155 | initControllerGrids . . . . in org.grails.plugin.easygrid.EasygridInitService
|     45 | doCall                      in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2
|     43 | initializeGrids . . . . . . in org.grails.plugin.easygrid.EasygridInitService
|     53 | doCall                      in EasygridGrailsPlugin$_closure3
|    334 | innerRun . . . . . . . . .  in java.util.concurrent.FutureTask$Sync
|    166 | run                         in java.util.concurrent.FutureTask
|   1145 | runWorker . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run                         in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . . . . . . . . in java.lang.Thread
Caused by NullPointerException: Cannot get property 'type' on null object
->>  219 | getPropertyType             in org.grails.plugin.easygrid.GridUtils
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    108 | doCall                      in org.grails.plugin.easygrid.datasource.GormDatasourceService$_addDefaultValues_closure6
|    100 | addDefaultValues . . . . .  in org.grails.plugin.easygrid.datasource.GormDatasourceService
|     65 | callDSAddDefaultValues      in org.grails.plugin.easygrid.EasygridDispatchService
|    334 | addDefaultValues . . . . .  in org.grails.plugin.easygrid.EasygridInitService
|    168 | initializeFromClosureMethod in     ''
|    157 | doCall . . . . . . . . . .  in org.grails.plugin.easygrid.EasygridInitService$_initControllerGrids_closure5
|    155 | initControllerGrids         in org.grails.plugin.easygrid.EasygridInitService
|     45 | doCall . . . . . . . . . .  in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2
|     43 | initializeGrids             in org.grails.plugin.easygrid.EasygridInitService
|     53 | doCall . . . . . . . . . .  in EasygridGrailsPlugin$_closure3
|    334 | innerRun                    in java.util.concurrent.FutureTask$Sync
|    166 | run . . . . . . . . . . . . in java.util.concurrent.FutureTask
|   1145 | runWorker                   in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                         in java.lang.Thread
| Error 2013-11-13 04:20:51,894 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing Grails: Failed to initialize grid: vehicleOfInterest.
Message: Failed to initialize grid: vehicleOfInterest.
    Line | Method
->>  171 | initializeFromClosureMethod in org.grails.plugin.easygrid.EasygridInitService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    157 | doCall                      in org.grails.plugin.easygrid.EasygridInitService$_initControllerGrids_closure5
|    155 | initControllerGrids . . . . in org.grails.plugin.easygrid.EasygridInitService
|     45 | doCall                      in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2
|     43 | initializeGrids . . . . . . in org.grails.plugin.easygrid.EasygridInitService
|     53 | doCall                      in EasygridGrailsPlugin$_closure3
|    334 | innerRun . . . . . . . . .  in java.util.concurrent.FutureTask$Sync
|    166 | run                         in java.util.concurrent.FutureTask
|   1145 | runWorker . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
|    615 | run                         in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . . . . . . . . in java.lang.Thread
Caused by NullPointerException: Cannot get property 'type' on null object
->>  219 | getPropertyType             in org.grails.plugin.easygrid.GridUtils
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    108 | doCall                      in org.grails.plugin.easygrid.datasource.GormDatasourceService$_addDefaultValues_closure6
|    100 | addDefaultValues . . . . .  in org.grails.plugin.easygrid.datasource.GormDatasourceService
|     65 | callDSAddDefaultValues      in org.grails.plugin.easygrid.EasygridDispatchService
|    334 | addDefaultValues . . . . .  in org.grails.plugin.easygrid.EasygridInitService
|    168 | initializeFromClosureMethod in     ''
|    157 | doCall . . . . . . . . . .  in org.grails.plugin.easygrid.EasygridInitService$_initControllerGrids_closure5
|    155 | initControllerGrids         in org.grails.plugin.easygrid.EasygridInitService
|     45 | doCall . . . . . . . . . .  in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2
|     43 | initializeGrids             in org.grails.plugin.easygrid.EasygridInitService
|     53 | doCall . . . . . . . . . .  in EasygridGrailsPlugin$_closure3
|    334 | innerRun                    in java.util.concurrent.FutureTask$Sync
|    166 | run . . . . . . . . . . . . in java.util.concurrent.FutureTask
|   1145 | runWorker                   in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                         in java.lang.Thread
| Error 2013-11-13 04:20:51,900 [localhost-startStop-1] ERROR [localhost].[/lpr-web]  - Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
Message: Error executing bootstraps; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Failed to initialize grid: vehicleOfInterest.
    Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by GrailsConfigurationException: Failed to initialize grid: vehicleOfInterest.
->>  171 | initializeFromClosureMethod in org.grails.plugin.easygrid.EasygridInitService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    157 | doCall    in org.grails.plugin.easygrid.EasygridInitService$_initControllerGrids_closure5
|    155 | initControllerGrids in org.grails.plugin.easygrid.EasygridInitService
|     45 | doCall    in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2
|     43 | initializeGrids in org.grails.plugin.easygrid.EasygridInitService
|     53 | doCall    in EasygridGrailsPlugin$_closure3
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by NullPointerException: Cannot get property 'type' on null object
->>  219 | getPropertyType in org.grails.plugin.easygrid.GridUtils
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    108 | doCall    in org.grails.plugin.easygrid.datasource.GormDatasourceService$_addDefaultValues_closure6
|    100 | addDefaultValues in org.grails.plugin.easygrid.datasource.GormDatasourceService
|     65 | callDSAddDefaultValues in org.grails.plugin.easygrid.EasygridDispatchService
|    334 | addDefaultValues in org.grails.plugin.easygrid.EasygridInitService
|    168 | initializeFromClosureMethod in     ''
|    157 | doCall .  in org.grails.plugin.easygrid.EasygridInitService$_initControllerGrids_closure5
|    155 | initControllerGrids in org.grails.plugin.easygrid.EasygridInitService
|     45 | doCall .  in org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2
|     43 | initializeGrids in org.grails.plugin.easygrid.EasygridInitService
|     53 | doCall .  in EasygridGrailsPlugin$_closure3
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run . . . in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run       in java.lang.Thread

The grid config:

    def vehicleOfInterestGrid = {
        dataSourceType 'gorm'
        gridRenderer '/templates/easygrid/jqGridRendererCreateEditDelete'
        domainClass VehicleOfInterest
        gridImpl 'jqgrid'
        inlineEdit true
        enableFilter true
        export {
            export_title 'VehiclesOfInterest - ' + new Date()
        }
        beforeSave { params ->
            params['dateCaptured'] = new Date()
            params['guid'] = randomUUID() as String
            params['deleted'] = false
            params['fakeColumn1'] = 'Default'
            params
        }
        updateRowClosure {
            def instance = VehicleOfInterest.get(params.id as Integer)
            if (!instance) {
                return 'default.not.found.message'
            }

            if (params.version) {
                def version = params.version.toLong()
                if (instance.version > version) {
                    return 'default.optimistic.locking.failure'
                }
            }

            params['dateCaptured'] = new Date()
            //call the beforeSave closure directly here - because for some reason the gridConfig is not passed to this closure
            instance.properties = params
            log.debug "instance = $instance"

            if (!instance.save(flush: true)) {
                return instance.errors
            }
        }
        jqgrid {
            caption "'Vehicles of Interest'"
        }
        columns {
            id {
                type 'id'
                hidden true
            }
            fakeColumn1 {
                label 'Date'
                jqgrid {
                    width 67
                    frozen true
                }
            }
...
            version {
                type 'version'
            }
        }
    }

easygrid pagination area is getting chopped with jqgrid width

Hi,
I am using Grails EasyGrid plugin and its really cool and working great. I have a question and i am struggling from last few days.

My Problem:

  • My problem is with jqgrid width column. If i put jqgrid width=100, the pagination area is getting chopped. pagination is always getting displayed at the far right end of the jqgrid.

How can i show the pagination by adjusting the jqgrid width.

Any help would be great.

filtering by individual columns..

maybe I'm just not groking the plugin but can I do the following?

create a grid with 5 columns.. 3 of the columns are filterable.. you can filter by any of the three individually.. I tried the form but it always shows one field.. I assume ff.name is important to it.. I tried using another name for my fields and they show but the filter doesn't use them..

what I had thought about doing was my own drop downs and on change make the ajax call myself.. before I go down this path I wanted to make sure I wasn't missing something that already does something similar..

what would be slick is to tie a drop down (maybe in a dialog) that appears when clicking the column header (assuming no sort).. it would then contain the values to filter by.. actually something like Excel's table filtering thing would be real slick! hmmmm

Row data has null IDs

The ajax call to Rows (to populate the grid) returns all the data correctly except the IDs are null. This means that inline editing is not possible since there is no ID with which to lookup the associated entity before merging. This was working corrrectly in v1.3.0

EasygridConfig and gorm datasource

I am getting following error

No signature of method: ProductGridController.dataSourceType() is applicable for argument types: (java.lang.String) values: [gorm]

I have also added the following in the EasygridConfig.groovy file. By the way where can I get the correct content for the config file?

import org.grails.plugin.easygrid.AutocompleteService
import org.grails.plugin.easygrid.Filter
import org.grails.plugin.easygrid.GridUtils
import org.grails.plugin.easygrid.grids.DataTablesGridService

def stdDateFormat = 'MM/dd/yyyy'
easygrid {

//default values added to each defined grid  ( if they are not already set )
defaults {

    defaultMaxRows = 10 // the max no of rows displayed in the grid

    //used for automatically generating label messages from the column name
    //this will be transformed into a SimpleTemplateEngine instance ( '#' will be replaced with '$') and the binding variables will be: labelPrefix , column, gridConfig
    labelFormat = '#{labelPrefix}.#{column.name}.label'

    //called before inline editing : transforms the parameters into the actual object to be stored
    beforeSave = { params -> params }

    gridImpl = 'jqgrid' // the default grid implementation

    // these are properties used by the jqgrid template
    enableFilter = true
    addNavGrid = true
    idColName = 'id'

    fixedColumns = true
    noFixedColumns = 1

    //default export settings for various formats
    export {
        exportService = org.grails.plugin.easygrid.EasygridExportService
        maxRows = 10000 // maximum rows to be exported - to avoid out of memory exceptions

        //this section provides default values for the different export formats
        // for more options check out the export plugin

        // csv settings
        csv {
            separator = ','
            quoteCharacter = '"'
        }
        csv['header.enabled'] = true

        // excel settings
        excel['header.enabled'] = true
        //property that aggregates the widths defined per column
        excel['column.widths'] = { gridConfig ->
            def widths = []
            GridUtils.eachColumn(gridConfig, true) { column ->
                widths.add(column?.export?.width ?: 0.2)
            }
            widths
        }

        // pdf settings
        pdf['header.enabled'] = true
        pdf['column.widths'] = { gridConfig ->
            def widths = []
            GridUtils.eachColumn(gridConfig, true) { column ->
                widths.add(column?.export?.width ?: 0.2)
            }
            widths
        }
        pdf['border.color'] = java.awt.Color.BLACK
        pdf['pdf.orientation'] = 'landscape'

        // rtf settings
        rtf['header.enabled'] = true
        rtf {
        }

        // ods settings
        ods {
        }

        // xml settings
        xml['xml.root'] = { gridConfig ->
            //defaults to the export title
            gridConfig.export.export_title
        }
        xml {
        }
    }

    // jqgrid default properties
    // check the jqgrid documentation
    jqgrid {
        width = '"100%"'
        height = 250
        // number of rows to display by default
        rowNum = 20
    }

    dataTables {
    }

    visualization {
        page = "'enable'"
        allowHtml = true
        alternatingRowStyle = true

// showRowNumber = false
pageSize = 10
}

    // default security provider
    // spring security implementation
    // interprets the 'roles' property
    securityProvider = { grid, oper ->
        if (!grid.roles) {
            return true
        }
        def grantedRoles
        if (Map.isAssignableFrom(grid.roles.getClass())) {
            grantedRoles = grid.roles.findAll { op, role -> oper == op }.collect { op, role -> role }
        } else if (List.isAssignableFrom(grid.roles.getClass())) {
            grantedRoles = grid.roles
        } else {
            grantedRoles = [grid.roles]
        }
        SpringSecurityUtils.ifAllGranted(grantedRoles.inject('') { roles, role -> "${roles},${role}" })
    }

    //default autocomplete settings
    autocomplete {
        idProp = 'id'  // the name of the property of the id of the selected element (optionKey - in the replaced select tag)
        maxRows = 10 // the max no of elements to be displayed by the jquery autocomplete box
        template = '/templates/autocompleteRenderer' //the default autocomplete renderer
        autocompleteService= AutocompleteService
        showSeparateLabel = false
        autocompleteSize = 30
    }
}

// each grid has a "type" - which must be one of the datasources defined here
dataSourceImplementations {
    //deprecated
    domain {
        // mandatory attribute: domainClass or initialCriteria
        dataSourceService = org.grails.plugin.easygrid.datasource.GormDatasourceService
        filters {
            //default search closures for different column types
            text = { Filter filter -> ilike(filter.filterable.name, "%${filter.paramValue}%") }
            number = { Filter filter -> eq(filter.filterable.name, filter.paramValue as int) }
            //todo
            date = { Filter filter -> eq(filter.filterable.name, filter.paramValue as Date) }

        }
    }

    // renamed for consistency - todo  -rename everywhere
    gorm {
        // mandatory attribute: domainClass or initialCriteria
        dataSourceService = org.grails.plugin.easygrid.datasource.GormDatasourceService
        filters {
            //default search closures
            text = { Filter filter -> ilike(filter.filterable.name, "%${filter.paramValue}%") }
            number = { Filter filter -> eq(filter.filterable.name, filter.paramValue as int) }
            //todo
            date = { Filter filter -> eq(filter.filterable.name, filter.paramValue as Date) }

        }
    }

    list {
        //mandatory attributes: context, attributeName
        dataSourceService = org.grails.plugin.easygrid.datasource.ListDatasourceService
        filters {
            //default search closures
            text = { Filter filter, row -> row[filter.filterable.name].contains filter.paramValue }
            number = { Filter filter, row -> row[filter.filterable.name] == filter.paramValue as int }
            //todo
            date = { Filter filter, row -> row[filter.filterable.name] == filter.paramValue as Date }

        }
    }

    custom {
        // mandatory attributes: 'dataProvider', 'dataCount'
        dataSourceService = org.grails.plugin.easygrid.datasource.CustomDatasourceService
    }
}

// these are the actual UI grid implementations
// will be specified in the grid config using the 'gridImpl' property
gridImplementations {

    //grails classic implementation - for demo purposes
    classic {
        gridRenderer = '/templates/easygrid/classicGridRenderer'
        gridImplService = org.grails.plugin.easygrid.grids.ClassicGridService
        inlineEdit = false
        formats = [
                (Date): { it.format(stdDateFormat) },
                (Boolean): { it ? "Yes" : "No" }
        ]
    }

    //  jqgrid implementation
    jqgrid {
        gridRenderer = '/templates/easygrid/jqGridRenderer'          //  a gsp template that will be rendered
        gridImplService = org.grails.plugin.easygrid.grids.JqueryGridService  // the service class for this implementation
        inlineEdit = true    // specifies that this implementation allows inline Editing

        // there are 3 options to format the data
        // using the value closure in the column
        // using the named formatters ( defined below )
        // using the default type formats ( defined here ) - where you specify the type of data & the format closure
        formats = [
                (Date): { it.format(stdDateFormat) },
                (Calendar): { Calendar cal -> cal.format(stdDateFormat) },
                (Boolean): { it ? "Yes" : "No" }
        ]
    }

    //  jquery datatables implementation
    dataTables {
        gridImplService = DataTablesGridService
        gridRenderer = '/templates/easygrid/dataTablesGridRenderer'
        inlineEdit = false
        formats = [
                (Date): { it.format(stdDateFormat) },
                (Boolean): { it ? "Yes" : "No" }
        ]
    }

    // google visualization implementation
    visualization {
        gridImplService = org.grails.plugin.easygrid.grids.VisualizationGridService
        gridRenderer = '/templates/easygrid/visualizationGridRenderer'
        inlineEdit = false
        formats = [
                (Date): { def cal = com.ibm.icu.util.Calendar.getInstance(); cal.setTime(it); cal.setTimeZone(com.ibm.icu.util.TimeZone.getTimeZone("GMT")); cal }, //wtf?
        ]
    }

/*
// google visualization implementation
nggrid {
gridImplService = org.grails.plugin.easygrid.grids.NgGridService
gridRenderer = '/templates/easygrid/ngGridRenderer'
inlineEdit = true
formats = [
]
}
*/

}

// section to define per column configurations
columns {

    //default values for the columns
    defaults {
        enableFilter = true
        showInSelection = true
        sortable = true
        jqgrid {
            editable = true
        }
        classic {
            sortable = true
        }
        visualization {
            search = false
            searchType = 'text'
            valueType = com.google.visualization.datasource.datatable.value.ValueType.TEXT
        }
        dataTables {
            sWidth = "'100%'"
            sClass = "''"
        }
        export {
            width = 25
        }
    }

    // predefined column types  (set of configurations)
    // used to avoid code duplication
    types {
        id {
            property = 'id'
            enableFilter = false

            jqgrid {
                width = 40
                fixed = true
                search = false
                editable = false

// formatter = 'editFormatter'
}
visualization {
valueType = com.google.visualization.datasource.datatable.value.ValueType.NUMBER
}
export {
width = 10
}

        }

        actions {
            value = { '' }
            jqgrid {
                formatter = '"actions"'
                editable = false
                sortable = false
                resizable = false
                fixed = true
                width = 60
                search = false
                formatoptions = '{"keys":true}'
            }
            export {
                hidden = true
            }
        }

        version {
            property = 'version'
            jqgrid {
                hidden = true
            }
            export {
                hidden = true
            }
            visualization {
                valueType = com.google.visualization.datasource.datatable.value.ValueType.NUMBER
            }
        }
    }
}

//section to define the filter form configurations
//todo - default service & default template
filterForm {
    defaults{
        filterFormService = org.grails.plugin.easygrid.FilterFormService
        filterFormTemplate =  '/templates/filterFormRenderer'
    }
}


// here we define different formatters
// these are closures  which are called before the data is displayed to format the cell data
// these are specified in the column section using : formatName
formats {
    stdDateFormatter = {
        it.format(stdDateFormat)
    }
    visualizationDateFormatter = {
        def cal = com.ibm.icu.util.Calendar.getInstance(); cal.setTime(it); cal.setTimeZone(java.util.TimeZone.getTimeZone("GMT")); cal
    }
    stdBoolFormatter = {
        it ? "Yes" : "No"
    }

    nrToString = { nr ->
        if (nr / 1000000000 >= 1) {
            "${(nr / 1000000000) as int} billion"
        } else if (nr / 1000000 >= 1) {
            "${(nr / 1000000) as int} million"
        } else if (nr / 1000 >= 1) {
            "${(nr / 1000) as int}k"
        } else {
            "${nr}"
        }
    }
    authorWikiFormat = {
        "<a href='http://en.wikipedia.org/wiki/${it.replace(" ", "_")}'>${it}</a>";
    }
}

}

Unable to filter

I have a grid setup using GORM and Source as the domain object. I am trying to add a column that uses a value several domains up in the hierarchy. Specifically environmentendpoint.cepenvironment.cep.name where name is a property of the Cep domain. Each domain in the hierarchy has a belongsTo association with the next domain in the hierarchy. I can get the value no problem but am unable to filter on it.

"environmentendpoint.cepenvironment.cep.name" {
                    label "CEP"
                    type "text"
                    value { source->
                        source.environmentendpoint.cepenvironment.cep.name
                    }
                    jqgrid {
                        search true
                        searchoptions "{sopt: ['eq', 'cn']}"
                    }
                }
dataSourceType "gorm"
            domainClass Source
            inlineEdit false
            enableFilter true
            jqgrid {
                rownumbers true
            }
            globalFilterClosure {params ->
                switch(params.searchOper) {
                case "eq":
                    eq(params.searchField, params.searchString)
                    break
                case "cn":
                    ilike(params.searchField, "%" + params.searchString + "%")
                    break
                }
            }

I am trying to use the globalFilterClosure because I am making use of the search feature in jqGrid. However, I have tried adding a filterClosure to the column with no luck. Below is the error I keep getting.

Error |
2014-03-02 11:52:06,059 [http-bio-8080-exec-9] ERROR errors.GrailsExceptionResolver  - QueryException occurred when processing request: [GET] /CEPInformation/sourcelistgrid/sourceListRows - parameters:
sord: asc
searchOper: eq
searchString: sm
page: 1
nd: 1393782726001
searchField: environmentendpoint.cepenvironment.cep.name
sidx: 
format: 
filters: 
rows: 100
_search: true
could not resolve property: environmentendpoint.cepenvironment.cep.name of: com.cerner.cep_information.domain.Source. Stacktrace follows:
Message: could not resolve property: environmentendpoint.cepenvironment.cep.name of: com.cerner.cep_information.domain.Source

By the way, I have also tried using:

def rusults = Source.findAll{
    environmentendpoint.cepenvironment.cep.name =~ params.searchString
}

I don't get an error with this but I also don't get any filtering.

By the way, sort is misspelled in the request params being sent to the server. This is probably on the jqGrid side.

Single grid from multiple domains

Hi Tudor,

If I wanted to create a single composite grid based on columns from multiple domains what would be the best way? I noticed that when using gorm as the dataSourceType a domainClass had to be specified. But this only gives the data from a single domain. What if I need a composite table with data from multiple domains? Is the best solution to create a new composite domain class then put that as the domainClass value. Is there a way to just get arbitrary columns from any domain class to create a composite grid without creating a new composite domain class? Thank you.

''' def overviewGrid = {
dataSourceType 'gorm'
domainClass DomainName1
gridImpl 'dataTables'
fixedColumns true
'''

Child Grid - Parent ID issue while adding / editing

Hi Tudor,

I am able to display the Owner (Parent) record value in Pets (child) grid
column {
firstName {
value {Pet pet->
"${pet.owner.firstName}" }}

How do I convert the value in firstName (to parent id value) while adding / editing ? It works OK, if I enter the id and fails if I enter the firstName. Any conversion is needed in beforeSave ? Can you please give an example code ?

Thank you.

Export service doesn't resolve InternalResourceView JSP

Hi Tudor,

Thanks for your plugin, it's very useful and abstract to be adapted for different purposes.
I'm using it to develop a internal administration tool for my company and I've chosen the dataTables implementation. I've customised lots of different stuff like filter between dates and mixed input text and select column filters.
Actually I can't move from a problem with the integrated export plugin into the easygrid one. I added the export button and when I click one of them I can see in the grails log that the easygridExportService is working building the result file. In fact if I ask for many entries as I have to wait longer as if I ask few entries. So, the problem is in the view resolution phase.

DEBUG JstlView | Forwarding to resource [/WEB-INF/grails-app/views/entry/entryDatatablesExport.jsp] in InternalResourceView 'null'

The resolved view is null and the browser result will be a 404. (my model is 'Entry')
Looks like everything is working well excepted the Spring resource mapping. But I verified in your project (Author and Book) and seems like you didn't configured anything at the Spring level about the final generated jsp.

I suppose the problem resides in a wrong installation but I don't really wont reinstall easygrid plugin cause I had customised it a lot and I don't work do that again after a new plugin installation. Or maybe it's just a specific configuration but I really checked out all configuration files, I compared them with your example application and seems like everything is fine.

Do you have any suggestions about it?

Thanks again for your plugin and for your help.

Danilo

jqGrid filters no longer work

I have found that the jqGrid filters rendered by v1.4.1 no longer work. My controller/grid-definition code is unchanged. The filtering worked in v1.3.0.

Inline editing - drop down

Hi,

How do we setup the inline editing to show the dropdown depending on values from a domain? say we have a set of type code and values from a different domain that the inline editing needs to use for a field.

Thanks

Provide or document the existing way to effectively edit inline date columns with jqgrid

I've not found yet a way to enable/disable inline editing for date columns when using jdgrids (sorry if it's my fault).
Particularly, for inline edits of date columns I need:

  • a way to configure the format used to bind the parameter value at controller level (in order to save date edits)
  • a way to avoid sending to the controller parameters for date columns not editable

PS: I've seen that the _Install.groovy script configures the following for jqGrid implementation:

inlineEdit = true    // specifies that this implementation allows inline Editing
editRenderer = '/templates/easygrid/jqGridEditResponse'

but I've not seen templates named that way: what's its purpose?

using filterForm in grails 2.3.3 results in "Tag [null] is missing required attribute [name] or [field]"

I created the following grid definition:

static grids = {
    bookGrid {
        dataSourceType 'gorm'
        domainClass Book
        gridImpl 'jqgrid'
        inlineEdit false
        enableFilter true

        filterForm {
            fields {
                'ff.name' {
                    label 'title'
                    type 'text'
                    filterClosure { Filter filter ->
                        ilike('title', "%${filter.paramValue}%")
                    }
                }
            }
        }

        columns {
            id{
                type 'id'
            }
            title {
                editable false
            }
        }
    }
}

And in my view, I have:

<r:require modules="easygrid-jqgrid"/>
...
<grid:filterForm name="bookGrid"/>
<grid:grid name="bookGrid"/>

When I try to view the grid, I get:

"Tag [null] is missing required attribute [name] or [field]"

Any ideas?

Oh, and is there something special about the 'ff.name' field in your filterForm definition?

Thanks for all your previous help, by the way!

Question : Filter records based on login

Hi Tudor,

Is it possible to add a where condition to the query generated by Easygrid to retrieve only the records the login user has permissions ? e.g. employee can see only certain region sales records. This permission info is stored in another domain/table. Any sample code is highly appreciated.

Thank you.

subgrid in jqgrid

Hi Tudor, how would you get a subgrid to show in jqgrid?

My domain has the following attributes:

    Attribute1 attribute1
    Attribute2 attribute2
    Float averageScore

My column definition is as follows:

    def domainNameGrid = {
        dataSourceType 'gorm'
        domainClass DomainName
        gridImpl 'jqgrid'
        fixedColumns false

        columns {
            'averageScore'{
                enableFilter false
        }
}

I want to be able to click on the averageScore row and have the other 2 attributes show up below. I found a section on subgrids in jqgrid docs: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:subgrid. However, I'm not sure how to integrate the example with Easygrid and Grails. Thank you.

Add Record - inline in the Grid

Hi Tudor,

Thanks for the EasyGrid plugin - . It is very useful and easy to implement

If an enhancement is done for Adding records also in the Grid, it will help a lot and full CRUD operations can be done in EasyGrid itself.

jqGrid has this feature. Row Editing / Inline Navigator in the Demo Pages.

Thanks!
.

GormDatasourceService - beforeSave callback incorrectly commented out

Applies to version 1.4.1

Line 244 of GormDatasourceService has been commented out, effectively breaking the inline editing functionality. I noticed that the master version does not have this comment so must assume that it was an erroneous commit. Kindly release this as a bug fix so that others may avoid the frustration I've experience trying to trace this!

Oh, and thank you - keep up the great work ;-)

In filterClosure, I'm trying to filter based on a hasMany association...

I'm creating a search field that filters on different criteria depending on the nature of the input. The domainClass bound to the grid is Account. If the search string only contains numbers, I assume the user is trying to search by account id, so my filter closure returns:

eq('id', input)

An Account hasMany = [phoneNumbers:PhoneNumber]

If the user's input looks like a phone number, then I want to return accounts where one of the phoneNumbers matches the input.

Something like the following pseudo code:

filterClosure { Filter filter ->
    if ( filterParamValueLooksLikePhoneNumber() ) {
        phoneNumbers {
            value == theInput
        }
    }
}

I've tried several different approaches but haven't had any luck. Can I do this without modifying your GormDatasourceService.createWhereQuery method?

Wrong demo link

The demo link you left on your documentation is pointed to your localhost, you might wanna change that.

That's all,

Happy holidays

Property dateColumn must be a valid Date

Hello,

Thanks for the EasyGrid. I am am newbie.and trying Grails and EasyGrid for POC.

Grid displays the data correctly. However I am getting "Property dateColumn must be a valid Date" error when I edit and try to save a record. No changes were made to the dateColumn.

Please help - where to configure the date format MM/dd/yyyy. I copied the settings of Config.Groovy and it has "def stdDateFormat = 'MM/dd/yyyy' "

Grails version: 2.3.5
Groovy version: 2.1.9
JVM version: 1.7.0_03
easygrid - 1.4.3

Thank you.

JQuery problem with Grails 2.1.1

Are there any issues with 2.1.1? I keep getting the following error, where EasyGrid worked perfectly before. Great project I'd really appreciate any insight you can give me. The project is broken up into various plugins, but EasyGrid seems to fail regardless of which plugin I use.

Thanks!

Pete C.

Line | Method

->> 464 | doFilter in C:\Users\valkrist\Documents\sanguisoft-0.2\mobile\grails-app\views\createBloodDrive\index.gsp


Caused by GrailsTagException: Error executing tag grid:grid: No such property: gridsConfig for class: com.sanguisoft.mobile.CreateBloodDriveController
->> 39 | doCall in C:/Users/valkrist/Documents/sanguisoft-0.2/mobile/grails-app/views/createBloodDrive/index.gsp


Caused by MissingPropertyException: No such property: gridsConfig for class: com.sanguisoft.mobile.CreateBloodDriveController
->> 39 | doCall in C__Users_valkrist_Documents_sanguisoft_0_2_mobile_grails_app_views_createBloodDrive_index_gsp$_run_closure3


| 50 | run in C__Users_valkrist_Documents_sanguisoft_0_2_mobile_grails_app_views_createBloodDrive_index_gsp
| 195 | doFilter . . . . in PageFragmentCachingFilter.java
| 63 | doFilter in AbstractFilter.java
| 55 | doFilter . . . . in SavedRequestFilter.java
| 449 | executeChain in org.apache.shiro.web.servlet.AbstractShiroFilter
| 365 | call . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter$1
| 90 | doCall in org.apache.shiro.subject.support.SubjectCallable
| 83 | call . . . . . . in ''
| 380 | execute in org.apache.shiro.subject.support.DelegatingSubject
| 362 | doFilterInternal in org.apache.shiro.web.servlet.AbstractShiroFilter
| 125 | doFilter in org.apache.shiro.web.servlet.OncePerRequestFilter
| 1145 | runWorker . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . . . . in java.lang.Thread

Grid that worked in 1.3 is broken in 1.4 (using Grails 2.3.0)

I have a simple grid that works fine with the 1.3 release of EasyGrid. When I upgrade to 1.4 and try it, I get a 404. The url is the same in both versions:

http://localhost:8080/grid/foobar/virtualNumbersGridRows?format=&_search=false&nd=1381785515389&rows=10&page=1&sidx=&sord=asc

Here's the grid definition:

static grids = {
    virtualNumbersGrid {
        dataSourceType 'gorm'
        domainClass VirtualNumber
        gridImpl 'jqgrid'
        inlineEdit true
        columns {
            shortName
        }

        jqgrid {
            rowNum 10
            rowList '[10,20,30]'
        }

    }
}

Question - jqgrid Multi sort order

Hi,

Is the multiSort option of jqgrid supported by Easygrid on the controller side?

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options

I tried and getting an error.

"If set to true enables the multisorting. The options work if the datatype is local. In case when the data is obtained from the server the sidx parameter contain the order clause. It is a comma separated string in format field1 asc, field2 desc โ€ฆ, fieldN. Note that the last field does not not have asc or desc. It should be obtained from sord parameter"

Thank you.

How can I give the 'static grids' closure definition from outside of controller?

Hi, thanks for this Easy grid use plugin. It is very useful.

I want to generate the 'static grids' value from another program which
works as a 'Wizard Tool for Generate Table Definition'.

To separate controller and "grids definition" for 2-way edit with that wizard,
I want to assign the grids variable from outside of controller, for example,
BootStrap.groovy.

===BootStrap.groovy===
class BootStrap {
def init = { servletContext ->
MyController.grid = = {
testGrid {
dataSourceType 'gorm'
:
columns {
col1
col2
col3
}
}

}

But as you know, @EasyGrid AST Transformation scans the closure which
is assigned to the static grids variable, and try to get column names from the
closure. AFAIK, the column names are used to generate following housekeeping
methods in the controller:

def <columnName>GridHtml() {
def <columnName>GridRows() {
def <columnName>GridExport() {
def <columnName>GridInlineEdit(){
def <columnName>GridAutocompleteResult (){
def <columnName>GridSelectionLabel (){

When I simply assign a closure which defining grids from outside
of controller(for example BootStrap.groovy), because of @EasyGrid AST Transformation
can't know it, those methods are not be generated and some errors are caused.

Is there any option to give required column names and generate those
housekeeping methods without defining grids closure in place?

(I tried @Mixin/@category, and 'dynamic controller plugin', to
inject above methods, and it works a little, but I don't want to define
another handmade version of those method..)

Best regards,

Enum datatype

Hi Tudor, thanks for making a great Grails plugin. I'm using the filterForm section with an Enum field defined as follows:

enum SexEnum {
MALE("Male"),
FEMALE("Female")
final String value
SexEnum(String value) {this.value = value}

//shows value in select drop down
String toString() {value}

//stores value in database
String getId() {value}

//returns Enum constant associated with value
String getKey(){name()}

}

My filterForm section in my controller is as follows:

filterForm {
fields {
'sex' {
label 'sex'
type 'text'
filterClosure{ Filter filter ->
eq('sex', filter.params.sex)
}
}
}
}

The filter works partially, ie if I input MALE or FEMALE it filters. However, if I input Male or Female or nothing(ie empty field), it returns nothing even if I am concurrently filtering on another field like name or age (not shown). I would like it to behave like the text filters ie if I type m or M or Male it should filter and find Male. What is the best way to handle Enum datatypes with filterForm in EasyGrid? Thank you.

unable to install

Grails is not able to download/install the plugin. The error I get is below.

Error Resolve error obtaining dependencies: Failed to read artifact descriptor for org.grails.plugins:easygrid:zip:1.4.6 (Use --stacktrace to see the full trace)

Thanks

Editing error when using Integer ID

My domain classes use Integer IDs which have become problematic since switching from v1.3.0 to v1.4.1. I tried converting from String to Integer in the beforeSave block, but this isn't invoked until after the problem occurs.

Provided id of the wrong type for class VehicleOfInterest. Expected: class java.lang.Integer, got class java.lang.String. Stacktrace follows:
org.hibernate.TypeMismatchException: Provided id of the wrong type for class VehicleOfInterest. Expected: class java.lang.Integer, got class java.lang.String
    at org.grails.plugin.easygrid.datasource.GormDatasourceService.updateRow(GormDatasourceService.groovy:215)
    at org.grails.plugin.easygrid.EasygridDispatchService.callDSUpdateRow(EasygridDispatchService.groovy:94)
    at org.grails.plugin.easygrid.grids.JqueryGridService.inlineEdit(JqueryGridService.groovy:88)
    at org.grails.plugin.easygrid.EasygridDispatchService.callGridImplInlineEdit(EasygridDispatchService.groovy:48)
    at org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2_closure10_closure14.doCall(EasygridInitService.groovy:76)
    at org.grails.plugin.easygrid.EasygridService.guard(EasygridService.groovy:187)
    at org.grails.plugin.easygrid.EasygridInitService$_initializeGrids_closure2_closure10_closure17_closure18.doCall(EasygridInitService.groovy:103)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:186)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

From: GormDatasourceService.groovy

    @Transactional
    def updateRow(gridConfig) {
       //
       //  The problem happens here....
       //
        def instance = gridConfig.domainClass.get(params.id)
        if (!instance) {
            return 'default.not.found.message'
        }

        if (params.version) {
            def version = params.version.toLong()
            if (instance.version > version) {
                return 'default.optimistic.locking.failure'
            }
        }

        //default returns params

       //
       //  And the opportunity for conversion is here...
       //
        instance.properties = gridConfig.beforeSave params
        log.debug "instance = $instance"

        if (!instance.save(flush: true)) {
            return instance.errors
        }
    }

GridConfig DataSourceService is Null

I'm getting the following error when I attempt to render a page using a jqGrid. I'm using EasyGrid 1.4.1 and Grails 2.3.4.

2013-12-13 14:07:44,386 ERROR context.GrailsContextLoader 213 - Error initializing the application: assert gridConfig.dataSourceService
   |          |
   |          null
   GridConfig{blkUpldJQGrid}
Assertion failed: 
assert gridConfig.dataSourceService
   |          |
   |          null
   GridConfig{blkUpldJQGrid}
at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:399)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:655)
at org.grails.plugin.easygrid.EasygridInitService.addDefaultValues(EasygridInitService.groovy:233)
at org.grails.plugin.easygrid.EasygridInitService$addDefaultValues$0.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.grails.plugin.easygrid.EasygridInitService.initializeFromClosureMethod(EasygridInitService.groovy:168)

Bellow are my Domain, Controller and GSP pages.

Domain:

class BulkUpload {
    String fhlmcLoanNum
    String referralBusinessUnit
    String remedyType
    String violationTypeCatPerDirective
    String subViolationType
    String servicerIDNumber
    String ssLoanNum
    String servicerName
    String requester
    String amount
    String comments
    String originationServicing
    String idUserCreate
    String idUserLastUpdate
    Date dateTimeCreated
    Date dateTimeLastUpdated
}

Controller:

import org.grails.plugin.easygrid.Easygrid
import org.grails.plugin.easygrid.Filter

import com.freddiemac.srm.domains.BulkUpload

@Easygrid
class ViewBulkUploadsController {

    def blkUpldJQGridGrid = {
        dataSourceType 'grom'
        domainClass BulkUpload
        gridImpl 'jqgrid'
        inlineEdit false
        export { export_title 'Bulk Upload' }
        jqgrid { width '"900"' }
        columns {
            id { type 'id' }
            fhlmcLoanNum
            referralBusinessUnit
            remedyType
            violationTypeCatPerDirective
            subViolationType
            servicerIDNumber
            ssLoanNum
            servicerName
            requester
            amount 
            comments
            originationServicing
        }
    }

    def index() {
    }
}

GSP Page:

<%@ page contentType="text/html;charset=UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>View Bulk Uploads</title>
<r:require modules="easygrid-jqgrid-dev,export" />
<r:layoutResources />
</head>
<body>
    <div class="body">
        <h1>Bulk imported Data</h1>
        <grid:grid id='gqGrid' name='blkUpldJQGrid'
            jqgrid.caption="'Bulk Uploads'" jqgrid.width='"900"' />
    </div>
    <r:layoutResources />
</body>
</html>

The table does exists in the database and does have data in it. Am I missing a config some where? Thanks!

How to use the List datasource?

I am new to grails and to EasyGrid. Sorry in advance for the long post. I have written a service to return data from my models and I want to display the results in an EasyGrid. Here is the service:

def listCustomers(params) {
    def result = [:]

    params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)

    def user = springSecurityService.currentUser

    result.customers = Order.executeQuery('select distinct c.company company, c.id id from Customer c join c.orders o join o.mergeLists m join m.broker b where b.id = ? order by 1', [ user.dbID ], params )
    result.count = Order.executeQuery('select count(distinct c.company) from Customer c join c.orders o join o.mergeLists m join m.broker b where b.id = ? order by 1', [ user.dbID ], params )

    if (!result.customers) {
        result.error = [code: 'Query-Failed', args:'listCustomers']
        result.count = 0
    }
    else
    {
        result.error = [code: 0, args:'']
    }

    return result
}

I return a result map with three keys (customers, count and error). My controller looks like this:

def broker_mailers() {

    def result = brokerAccessService.listCustomers(params)
    if (result.error.code == 0) {
        render(template: "broker_level1", model: [ customerList: result.customers, count: result.count ])
        return
    }

    flash.message = g.message(code: result.error.code, args: result.error.args)
    flash.error = result.error.code

    render (template: 'broker_level1')

}

I am at a loss on how to configure the EasyGrid. I have tried this:

def brokerMailersGrid = { dataSourceType 'List' context 'model' attributeName 'result' enableFilter true inlineEdit false columns { id { type 'id' hidden } customers { label 'Mailers' } } }

The error I currently get is:
| Error 2014-03-18 11:44:24,413 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: assert gridConfig.dataSourceService
| |
| null
GridConfig{brokerMailers}

What is a dataSourceService? I don't see it in the documentation.

I can't find a good example of taking the data from the Model of a render. Is this a case for a custom service implementation instead?

Display datafrom multiple classes in one grid

I have a parent class in a hasone relationship with the child class, if I want to display data from both classes in one grid, would you recommend a custom closure or creating my own service?

Thanks

Format numbers in jqgrid

Hi Tudor,
How do I format numbers to 2 decimal places in my jqgrid? Thanks.

def domainNameGrid = {
        dataSourceType 'gorm'
        domainClass DomainName
        gridImpl 'jqgrid'
        fixedColumns false
        columns {
            'averageScore'{
                enableFilter false  
                }
                }
}

cascading jqgrids with initialCriteria specified

I am trying to output data using your Pet Clinic as an example. I will have three grids eventually, but for now I am just trying to cascade two grids. Note that both of my grids need to have initialCriteria (as I do not want to display all records in the database tables). Is this legal in the sub-grid?

My code contains:

    def brokerMailersGrid = {
        dataSourceType 'gorm'
        domainClass Customer
        initialCriteria {
            def user = springSecurityService.currentUser
            orders {
                mergeLists {
                    broker {
                        eq ('id', user.dbID)
                    }
                }
            }
            order("company")
        }
        enableFilter true
        inlineEdit false
        columns {
            id {
                type 'id'
                jqgrid {
                    hidden=true
                }
            }
            company {
                label "Mailer"
                filterClosure { Filter filter ->
                    ilike('company','%${filter.parnValue}%')
                }
                jqgrid {
                    width "250"
                }
            }
        }
    }

    def brokerMailerJobsGrid = {
        dataSourceType 'gorm'
        domainClass Order
        globalFilterClosure{ params ->
            eq('customer.id', params.customerId ? params.customerId as long: -1l)   
        }
        initialCriteria {
            def user = springSecurityService.currentUser
            mergeLists {
                broker {
                    eq ('id', user.dbID)
                }
            }
            order("bkrnum","desc")
        }
        enableFilter true
        inlineEdit false
        columns {
            ordnum {
                type 'id'
                label "PAS Num"
                enableFilter false
                jqgrid {
                    width "80"
                }
            }
            bkrnum {
                label "Job ID"
                filterClosure { Filter filter ->
                    ilike('bkrnum','%${filter.paramValue}%')
                }
                jqgrid {
                    width "150"
                }
            }
            orddate {
                label "Order Date"
                filterClosure { Filter filter ->
                    eq('orddate', new SimpleDateFormat('MM/dd/yyyy').parse(filter.paramValue))
                }
                jqgrid {
                    width "100"
                }
            }
        }
    }

Here are my view statements:

<grid:grid name="brokerMailers" jqgrid.width="450" jqgrid.caption='"Mailers"'/>
<grid:grid name="brokerMailerJobs" masterGrid="brokerMailers" childParamName="customerId" jqgrid.width="450" jqgrid.caption='"Merges"'/>
    <r:script>
        function addElement(lnk, gridId, param, master){
            var elem = jQuery('#'+gridId+'_table').jqGrid('getGridParam', 'selrow');
            console.log(elem);
            if(jQuery.isEmptyObject(elem)){
                alert("You have to select a "+master+" first");
                return;
            }
            document.location = lnk+"?"+param+"="+elem;;    
        }
    </r:script>
    <jq:jquery>
        console.log(jQuery('#brokerMailers_table').jqGridMethod('setSelection', 1));
    </jq:jquery>

When I execute this, I get a 404 error on the screen:
image

and this in the log (truncated the stack trace):

| Error 2014-03-19 12:07:51,768 [http-bio-8443-exec-1] ERROR errors.GrailsExceptionResolver - MissingMethodException occurred when processing request: [GET] /pasweb/customerAccess/brokerMailerJobsRows - parameters:
sord: asc
page: 1
nd: 1395245271519
sidx:
format:
rows: 20
_search: false
No signature of method: pasweb.CustomerAccessController$_closure2_closure13.doCall() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap, grails.gorm.DetachedCriteria) values: [[sord:asc, page:1, nd:1395245271519, sidx:, ...], ...]
Possible solutions: doCall(java.lang.Object), call(), call([Ljava.lang.Object;), call(java.lang.Object), findAll(). Stacktrace follows:
Message: No signature of method: pasweb.CustomerAccessController$_closure2_closure13.doCall() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap, grails.gorm.DetachedCriteria) values: [[sord:asc, page:1, nd:1395245271519, sidx:, ...], ...]
Possible solutions: doCall(java.lang.Object), call(), call([Ljava.lang.Object;), call(java.lang.Object), findAll()
Line | Method
->> 55 | unwrap in org.codehaus.groovy.runtime.ScriptBytecodeAdapter


| -1 | call in groovy.lang.Closure$call$2
| 45 | defaultCall . . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 108 | call in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 116 | call . . . . . . . . . . . . . . . . in ''
| 210 | doCall in org.grails.plugin.easygrid.datasource.GormDatasourceService$_createWhereQuery_closure8
| -2 | invoke0 . . . . . . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1254 | jlrMethodInvoke . . . . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 90 | invoke in org.codehaus.groovy.reflection.CachedMethod
| 233 | doMethodInvoke . . . . . . . . . . . in groovy.lang.MetaMethod
| 1086 | invokeMethod in groovy.lang.MetaClassImpl
| 1110 | invokeMethod . . . . . . . . . . . . in groovy.lang.ExpandoMetaClass
| 910 | invokeMethod in groovy.lang.MetaClassImpl
| 411 | call . . . . . . . . . . . . . . . . in groovy.lang.Closure

Does Easygrid work with Grails 2.2.1?

Hello,

It seems that Easygrid (1.3.0) does not work with Grails 2.2.1..

Freshly created grails app, freshly installed easygrid plugin, 'grails run-app --verbose':

| Loading Grails 2.2.1
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 1 source files
[groovyc] Compiling 1 source file to G:\workspace-ggts-3.2.0.RELEASE\easygrid_test\target\classes
| Compiling 1 source files.
| Error Error packaging application: java.lang.Class cannot be cast to java.lang.String
java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String
at groovy.util.ConfigObject.populate(ConfigObject.java:289)
at groovy.util.ConfigObject.populate(ConfigObject.java:293)
at groovy.util.ConfigObject.flatten(ConfigObject.java:121)
at groovy.util.ConfigObject.flatten(ConfigObject.java:110)
at grails.util.Holders.setConfig(Holders.java:87)
at org.codehaus.groovy.grails.commons.ConfigurationHolder.setConfig(ConfigurationHolder.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2410)
at groovy.lang.ExpandoMetaClass.setProperty(ExpandoMetaClass.java:1166)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3347)
at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:194)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:480)
at org.codehaus.groovy.grails.project.packaging.GrailsProjectPackager.createConfig(GrailsProjectPackager.groovy:359)
at org.codehaus.groovy.grails.project.packaging.GrailsProjectPackager.packageApplication(GrailsProjectPackager.groovy:260)
at org.codehaus.groovy.grails.project.packaging.GrailsProjectPackager$packageApplication.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:727)
at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:44)
at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1147)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.Closure.call(Closure.java:412)
at groovy.lang.Closure.call(Closure.java:406)
at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
at RunApp$_run_closure1.doCall(RunApp.groovy:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:727)
at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:44)
at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1147)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:729)
at gant.Gant.invokeMethod(Gant.groovy)
at groovy.lang.GroovyObject$invokeMethod.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
at gant.Gant.executeTargets(Gant.groovy:591)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:231)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
at gant.Gant.executeTargets(Gant.groovy:590)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeWithGantInstance(GrailsScriptRunner.java:768)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptFile(GrailsScriptRunner.java:566)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:465)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:409)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:373)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error Error packaging application: java.lang.Class cannot be cast to java.lang.String

LabelFormat - Columns

Hi Tudor,

Is there a setting in EasyGridConfig for labelFormat to display the column name like Grails Scaffolding - automatic camelCase column name conversion ?

Grails scaffold UI displays the column name - entryDate as "Entry Date". I am looking for same behavior / configuration in EasyGrid and avoid using 'label' for each column.

Thank you.

Change styles

I wanted to add the bootstrap styling to datatables via the datatables bootstrap plugin. I changed the datatables template to reference the new styles from instruction on the site. Unfortunately the style class is still display even though the template references new class values. I cleaned and restarted my project and still no luck do I need to do other things? Do I need to create a renderer, service and template to do this?

Thank you for the great plugin

Strange error.. NullPointerException: Cannot invoke method indexOf() on null object

I'm getting this error only when I hit the page running the easygrid (jqgrid).. it extra strange because it's the error page.. yet the page that's rendered is the page with the easygrid on it.. I thought maybe it was an ajax call in the background failing but in firebug I don't see any calls failing (they all have a 200 or 302 return code)...

any thoughts?
thanks!

grails 2.2.3... easygrid 1.4.1

the line in question is:

            ${request.'javax.servlet.error.message'.indexOf(':') != -1 ? request.'javax.servlet.error.message'?.substring(0, request.'javax.servlet.error.message'?.indexOf(':')).encodeAsHTML() : request.'javax.servlet.error.message'?.encodeAsHTML()}
Caused by NullPointerException: Cannot invoke method indexOf() on null object
->>   13 | doCall    in D__projects_PV_grails_app_views__errors_error_gsp$_run_closure2_closure13
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    101 | run       in D__projects_PV_grails_app_views__errors_error_gsp
|    186 | doFilter  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter
|    151 | invoke .  in net.bull.javamelody.JspWrapper
|    277 | invoke    in net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler
|    208 | doFilter  in net.bull.javamelody.MonitoringFilter
|    181 | doFilter  in     ''
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run . . . in java.lang.Thread

sizing (width) of columns in jqgrid

Hi Tudor,

How would we set the column sizes (width) in jqgrid? Thank you.

    columns {
            'averageScore'{
                enableFilter false
                value {
                //format gives 1 digit before decimal and 2 digits after decimal
                    String.format("%1.2f", it.averageScore) 
                }
            }
    }

Spring Security - Question

Hi Tudor,

I could not find any sample or more information on how to setup security for the grid . Could you please point me to the documentation or a sample code.

Readme has the following info - Easygrid comes by default with a spring security implementation. Using this default implementation you can specify which roles are allowed to view or inline edit the grid

System - Grails 2.3.5, spring security 2.0-RC2.

Thank you.

Error with Google Visualization: TableQueryWrapper is not defined

When trying out the plugin I get this error using a visualization grid type..

ReferenceError: TableQueryWrapper is not defined

I have google visualization plugin as well as jquery and jquery ui.. I noticed my versions are newer then the easygrid requires.. But I was guessing I was missing a JS include or something.. just don't see any reference to it anywhere in the docs.. any help would be great.. I think the plugin will be a nice upgrade to my manually coded google visualization table..

thanks!!

Problem with install Easygrid plugin

hi,

I am having problems getting the Easygrid plug in to work. Since I installed the plugin I get the following error compile error in my project:

"The project was not built since its build path is incomplete. Cannot find the class file for com.google.visualization.datasource.datatable.value.ValueType. Fix the build path then try building this project"

I have tried including the "compile('com.google.visualization:visualization-datasource:1.1.1')" but it just doesn't find this dependency and I get an error. Any ideas?

Thanks
Stephen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.