Last updated by admin 2 years ago
grails install-plugin remote-pagination
Last updated by amitjain 1 month ago
Installation
Just execute following from your application directory:
grails install-plugin remote-pagination
Using
If you have used paginate and sortableColumn tag, then you will find its usage very similar to them. The tags needs to reside inside the template, which renders the list of records.
Tags
The remote-pagination plugin currently provides the following tags:
util:remotePaginate
Purpose
Creates next/previous buttons and a breadcrumb trail to allow pagination of results, without a page refresh using ajax calls.
Example domain class
class Book {
String title
String author
}Example controller:
class BookController {
def list = {
[books: Book.list(params)]
} def updateList ={
render(template:"listTemplate" ,model:[ bookInstanceList: Book.list(params )])
}
}remotePaginate code:
<util:remotePaginate controller="book" action="updateList" total="${Book.count()}"
update="listTemplateDivId" max="20" pageSizes="[10, 20, 50,100]"/>Description
Attributes
- total (required) - The total number of results to paginate
- action (required) - the name of the action to use in the link
- update (required) – the id of the div/span which contains the tag to render the template, which displays the list.
- controller (optional) - the name of the controller to use in the link, if not specified the current controller will be linked
- id (optional) - The id to use in the link
- params (optional) - A map containing request parameters
- prev (optional) - The text to display for the previous link (defaults to "Previous" as defined by default.paginate.prev property in I18n messages.properties)
- next (optional) - The text to display for the next link (defaults to "Next" as defined by default.paginate.next property in I18n messages.properties)
- max (optional) - The number of records displayed per page (defaults to 10). Used ONLY if params.max is empty
- maxsteps (optional) - The number of steps displayed for pagination (defaults to 10). Used ONLY if params.maxsteps is empty
- offset (optional) - Used ONLY if params.offset is empty
- pageSizes(optional) - The list containing different page sizes user can select from(defaults to max attribute or the first value given in the list)
Events
- onSuccess (optional) - The javascript function to call if successful
- onFailure (optional) - The javascript function to call if the call failed
- on_ERROR_CODE (optional) - The javascript function to call to handle specified error codes (eg on404="alert('not found!')"). With Prototype, this prevents execution of onSuccess and onFailure.
- onUninitialized (optional) - The javascript function to call the a ajax engine failed to initialise
- onLoading (optional) - The javascript function to call when the remote function is loading the response
- onLoaded (optional) - The javascript function to call when the remote function is completed loading the response
- onComplete (optional) - The javascript function to call when the remote function is complete, including any updates
util:remoteSortableColumn
Purpose
Renders a remote sortable column to support sorting in tables , without a page refresh using ajax calls.
Examples
<util:remoteSortableColumn property="title" title="Title" update="listTemplateDivId"/>
<util:remoteSortableColumn property="title" title="Title" style="width: 200px" update="listTemplateDivId"/>
<util:remoteSortableColumn property="author" defaultOrder="desc" title="author"
titleKey="book.author" update="listTemplateDivId"/>Description
Attributes update, action and either title or titleKey are required. When title or titleKey attributes are specified then titleKey takes precedence, resulting in the title caption to be resolved against the message source. In case when the message could not be resolved, the title will be used as title caption.
Attributes
- property - name of the property relating to the field
- defaultOrder (optional) - default order for the property; choose between asc (default if not provided) and desc
- title (optional) - title caption for the column
- titleKey (optional) - title key to use for the column, resolved against the message source
- params (optional) - a map containing request parameters
- action (required) - the name of the action to use in the link
- update (required) – the id of the div/span which contains the tag to render the template, which displays the list.
- controller (optional) - the name of the controller to use in the link, if not specified the current controller will be linked
Events
- onSuccess (optional) - The javascript function to call if successful
- onFailure (optional) - The javascript function to call if the call failed
- on_ERROR_CODE (optional) - The javascript function to call to handle specified error codes (eg on404="alert('not found!')"). With Prototype, this prevents execution of onSuccess and onFailure.
- onUninitialized (optional) - The javascript function to call the a ajax engine failed to initialise
- onLoading (optional) - The javascript function to call when the remote function is loading the response
- onLoaded (optional) - The javascript function to call when the remote function is completed loading the response
- onComplete (optional) - The javascript function to call when the remote function is complete, including any updates
If you face any problem while installing the plugin, you may download it from
hereVersion History
Roadmap
Issues and improvements for this plugin are
maintained here on Codehaus JIRA.
Last updated by admin 2 years ago
Last updated by admin 2 years ago