tudor-malene / Easygrid

Grails plugin - simple and declarative way of defining a DataGrid
Apache License 2.0
27 stars 24 forks source link

Could not find grid definition for controller #129

Open nikersch opened 10 years ago

nikersch commented 10 years ago

Hello,

upfront - sorry for the probably very stupid question, but I am new to grails and dont see my mistake :).

I always get a could not find grid for controller error message:

image

I have the following structure in my code backed by a mysql database (works normally with scaffolding) - what am I missing?

Thank you in advance!

Domain-Class Book

package grailsmysql
class Book {

    String title
    String author

    static constraints = {
        title(blank: false)
        author(blank: false)
    }
}

Book-Controller

package grailsmysql
import org.grails.plugin.easygrid.Easygrid

@Easygrid
class BookController {

    //def scaffold = Book
    static allowedMethods = [save: "POST", update: "POST", delete: "POST"]

    def bookGrid = {
            domainClass Book
            columns {
                id {
                    type 'id'
                }
                version {
                    type 'version'
                }
                author
                title
            }
        }

    def jqgrid(){
    }
}

jqgrid.gsp in Views/book/

<!doctype html>
<html>
<head>
    <meta name="layout" content="grid">
    <title>JqGrid example</title>

    <asset:javascript src="easygrid.jqgrid.js"/>
    <asset:stylesheet src="easygrid.jqgrid.css"/>
    <r:require modules="easygrid-jqgrid-dev,export"/>

</head>

<body>

Test Text

<grid:grid id="mygrid" name="bookGrid"/>

<grid:exportButton name='bookGrid'/>

<asset:deferredScripts/>

</body>
</html>
tudor-malene commented 9 years ago

Hi, It should be:

<grid:grid id="mygrid" name="book"/>
<grid:exportButton name='book'/>

(Without the 'Grid' suffix)