Easygrid
Easygrid copied to clipboard
Could not find grid definition for controller
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:
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>
Hi, It should be:
<grid:grid id="mygrid" name="book"/>
<grid:exportButton name='book'/>
(Without the 'Grid' suffix)