Jqgrid is a jquery plugin that allows formatting data as table and has number of options - paging, sorting, filtering, inline editing etc. There are few good tutorials explaining the process to integrated jqgrid in your grails application.
http://pramodnepal.com.np/?p=119
http://www.grails.org/plugin/jqgrid
Following is a typical jquery script that can be used in a grails application. The property 'editable=true' make any of the field in grid as editable.
Often it is required to provide a drop down list for certain fields. To make any field as a combobox or a drop-down list make type as 'select' and provide 'editoptions'. eg: editoptions:{value:{1:'One',2:'Two'}}
The 'editoptions' list has to be hard coded or generated at the time of rendering. To dynamically generate the list using Ajax, we need to use the dataUrl as given below.
editoptions:{dataUrl:'${createLink(controller:"expenseType",action:"listAsSelect")}'}}
Controller action:
http://pramodnepal.com.np/?p=119
http://www.grails.org/plugin/jqgrid
Following is a typical jquery script that can be used in a grails application. The property 'editable=true' make any of the field in grid as editable.
Often it is required to provide a drop down list for certain fields. To make any field as a combobox or a drop-down list make type as 'select' and provide 'editoptions'. eg: editoptions:{value:{1:'One',2:'Two'}}
The 'editoptions' list has to be hard coded or generated at the time of rendering. To dynamically generate the list using Ajax, we need to use the dataUrl as given below.
editoptions:{dataUrl:'${createLink(controller:"expenseType",action:"listAsSelect")}'}}
Controller action:
def listAsSelect={
def lst = ExpenseType.findAllByExpenseFlag('Y')
println (lst.size())
StringBuffer buf = new StringBuffer("")
render buf.toString()
}
Thank you very match. you save me
ReplyDeleteThanks a lot.You help me.Be happy because your post very helpful.Thanks..............
ReplyDeleteVery Nice, you saved my day
ReplyDelete