Redirect on rowSelection with JQGrid in grails
-
12-12-2019 - |
Question
I am using the plugin JQGrid 3.8.0.1 on a Grails Project having the Grails 2.0.3 version.
I have this <jqgrid:grid>
having an attribute onSelectRow
. I was planning to convert my redirect structure from the form structure to window structure. The reason for doing this conversion is that not all .gsp
files having a JQGrid component have a <form>
component in the <body>
area.
From this:
<jq:resources/>
<jqui:resources/>
<jqgrid:resources/>
<jqgrid:grid
// other main attributes (i.e., url, colNames, colModel, etc.)
onSelectRow="function(id) {
document.<formname>.action = 'view/' + id;
document.<formname>.submit();
}"></jqgrid:grid>
// html body content of form
<form name="<formname>">
</form>
To this:
<jq:resources/>
<jqui:resources/>
<jqgrid:resources/>
<jqgrid:grid
// other main attributes (i.e., url, colNames, colModel, etc.)
onSelectRow ="function(id) {
window.location.href = ${createLink(action:'show', id:id)};
}"></jqgrid:grid>
The
jq
,jqui
,jqgrid
tags are the plugins installed on the project by the grails commandgrails> install-plugin jquery jquery-ui jqgrid
The problem is the new script won't work. Upon checking the new html source code returns the value of onSelectRow
attribute window.location.href = /<Project Name>/<Controller>/show;
. The question is how can I have the JQGrid running properly on the new script.
Note: I am currently using the scaffold functionality of Grails or
generate-all *
command
Solution
onSelectRow: function(id,status)
{
//var rowData = jQuery(this).getRowData(id);
}
try to replace '='
with ':'
and try.