Jmesa Plugin

  • Tags: jmesa, grid format
  • Latest: 2.0.4-SNAPSHOT-0.1
  • Last Updated: 04 July 2012
  • Grails version: 2.0.0 > *
2 votes
Dependency:
compile ":jmesa:2.0.4-SNAPSHOT-0.1"

 Documentation  Source  Issues

Summary

Jmesa plugin is a dynamic html tabular representation of data that allows you to filter,sort, paginate, export your data.

Installation

grails install-plugin jmesa

Description

Overview

Allows Grails applications to easily integrate with the functionality. Utilizes Jmesa feature as an underlying mechanism so serves managing representation of data in tabular form, filter,sort, paginate, export your data.I recommend you read the Jmesa documentation before continuing to get a feel for how this plugin operates.

Concepts

Sort: Allow sorting feature based on Domain class field name.

Paginate: Provide the number of record need to be display.

Export: Provide export data in PDF and XLS format.

Filter: Allowing filtering of data based on domain class field name.

Installation

Install the plugin by using the below command or download the plugin and install by pointing to the path of the file where the plugin.zip is located.

grails install-plugin jmesa

Sample Example

The Jmesa grails plugin is very easy to use. After installing the plugin, the libs and resource are ready for you, you don't need to worry about them.

The libs you can find it in "plugins/jmesa-2.0.4/lib" folder.

Controller :

/** paginated by jmesa*/
    def list = {
        TableFacade tableFacade = new TableFacadeImpl("tag",request)
        def books = Book.list(params)
        if(!books || books.size() == 0){
            books = []
            50.times{ count ->
                def book = new Book(title:"learning Java part${count + 1}",
                                                author:"james",releaseTime:new Date())
                book.save()
                books << book
            }
        }
        tableFacade.items = books

Limit limit = tableFacade.limit

if(limit.isExported()){ tableFacade.setExportTypes response,limit.getExportType() tableFacade.setColumnProperties "title","author" tableFacade.render() }else return [bookList : books] }

view the gsp codes: :

<form name="bookForm" action="/pluginSample/book/list">
                <jmesa:tableFacade
                    id="tag"
                    items="${bookList}"
                    maxRows="15"
                    exportTypes="csv,excel"
                    stateAttr="restore"
                    var="bean"
                    >
                    <jmesa:htmlTable
                        caption="books"
                        width="600px"
                        >
                        <jmesa:htmlRow>
                            <jmesa:htmlColumn property="title" performFilterAndSort="true" >
                                       <a href="#">${bean.title}</a>
                            </jmesa:htmlColumn>
                            <jmesa:htmlColumn property="author"/>
                        </jmesa:htmlRow>
                    </jmesa:htmlTable>
                </jmesa:tableFacade>

</form>