【问题标题】:Redirect on rowSelection with JQGrid in grails在 grails 中使用 JQGrid 重定向 rowSelection
【发布时间】:2012-07-27 16:31:11
【问题描述】:

我在具有 Grails 2.0.3 版本的 Grails 项目中使用插件 JQGrid 3.8.0.1。

我有这个<jqgrid:grid> 有一个属性onSelectRow。我打算将我的重定向结构从表单结构转换为窗口结构。进行这种转换的原因是并非所有具有 JQGrid 组件的.gsp 文件在<body> 区域中都有<form> 组件。

从这里:

<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>

到这里:

<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>

jqjquijqgrid标签是grails命令grails&gt; install-plugin jquery jquery-ui jqgrid安装在项目上的插件

问题是新脚本不起作用。检查新的 html 源代码后,返回 onSelectRow 属性 window.location.href = /&lt;Project Name&gt;/&lt;Controller&gt;/show; 的值。问题是如何让 JQGrid 在新脚本上正常运行。

注意:我目前正在使用 Grails 的脚手架功能或generate-all * 命令

【问题讨论】:

  • 您需要在createLink函数中定义控制器名称。
  • 还是不行。即使没有定义控制器,Grails 也会返回一个默认的控制器名称,该名称是页面当前打包或位于grails-app/view 文件夹中的位置。

标签: grails redirect jqgrid grails-plugin grails-2.0


【解决方案1】:
onSelectRow: function(id,status)
{
     //var rowData = jQuery(this).getRowData(id); 
}

尝试将'=' 替换为':' 并尝试。

【讨论】:

  • 我无法将= 替换为:。我正在使用 JQGridTagLib &lt;jqgrid:grid&gt; 在 Grails 上的 JQGrid。你能按照上面给出的格式提供代码吗?谢谢。
  • 我已对我的代码进行了必要的调整。我只关心onSelectRow,其他属性在页面加载后正常工作。
猜你喜欢
  • 1970-01-01
  • 2012-06-03
  • 2023-03-03
  • 2012-09-08
  • 2015-02-20
  • 2010-12-29
  • 1970-01-01
  • 2011-11-24
  • 2012-04-06
相关资源
最近更新 更多