Let's look at how it can be done easily in just 3 steps:
1. In the person/list.gsp, specified the following code block before the </head> tag to import flexigrid resources:
<r:require module="flexigrid"/>
2. Render the flexigrid in the person/list.gsp using <g:flexigrid> tag, for example:
<g:flexigrid for="com.vobject.addressbook.Person" properties="title, firstName, lastName, dateOfBirth, remark" />
3. Enabled the Flexigrid support for the PersonController by adding the following configuration to the Config.groovy file:
grails.plugins.dynamicController.mixins = [
'com.vobject.flexigrid.FlexigridControllerMixin':'com.vobject.addressbook.PersonController'
]
Done! You will see the person list render as Flexigrid component in the picture above after you run "grails run-app". The <g:flexigrid> tag will render the first column as link and all columns with equal width by default.'com.vobject.flexigrid.FlexigridControllerMixin':'com.vobject.addressbook.PersonController'
]
Let's do some customization, I want to enabled link for the First Name column instead of Title column and custom width for each column like the following picture:
It is as simple as specify the linkProperty and columnWidth attribute, please see the following code:
<g:flexigrid for="com.vobject.addressbook.Person" properties="title, firstName, lastName, dateOfBirth, remark" linkProperty="firstName" columnWidth="30, 150, 100, 70, 300"/>
1 comment:
Is it possible to add Drop Down list Widget instead of Single line text or Plain text, if yes, then where I need to add it and how? Also how can we submit value in our database or what would be the possible way to design the database architecture using this plugin.
Post a Comment