问题
I create custom button "open" in grails easygrid plugin. I want get some parameters in this button. How I can get values from the selected row?
<grid:grid id='jqgridinitial' name='customerList' jqgrid.caption="'Customer'"
open="${g.createLink(controller: 'customer', action: 'index', params:[???] }"
回答1:
This is the javascript code to return the selected row:
var row = jQuery("#jqgridinitial_table").jqGrid('getGridParam','selrow');
But, I think what you actually need is a custom jqgrid formatter: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter
You can see an example here: https://github.com/tudor-malene/Easygrid_example/blob/master/grails-app/views/author/_jqgrid.gsp
and here is how it works ( you click on the author name and it links to wikipedia): 199.231.186.169:8080/easygrid/author/list?impl=jqgrid
In your case you should construct the link to the customer based on the actual row data
来源:https://stackoverflow.com/questions/22219944/how-to-get-selected-row-values-in-easygrid