【问题标题】:I could not make this work. ExtraButton To link to my Action (Srtus2-Jquery-Grid)我无法完成这项工作。 ExtraButton 链接到我的操作 (Srtus2-Jquery-Grid)
【发布时间】:2023-03-28 04:00:01
【问题描述】:

我已经有货了。我为 struts2 jQuery Grid 创建了一个额外的按钮。当我单击该按钮时,它应该转到我的操作。如何在点击时做到这一点?这是我的部分代码。

 navigatorExtraButtons="{
            seperator: { 
            title : 'seperator'  
            }, 
            hide : { 
            title : 'Show/Hide', 
            icon: 'ui-icon-wrench', 
            onclick: function(){ load('<s:url action="ProductInitialise"/>')  } //--> this doesn't work.
            },
            alert : { 
            title : 'Alert', 
            caption : 'Show Alert!', 
            onclick: function(){ alert('Grid Button clicked!') }
            }
            }"

【问题讨论】:

    标签: jquery jqgrid struts2 struts2-jquery struts2-jquery-grid


    【解决方案1】:

    navigatorExtraButtons&lt;sjg:grid /&gt;Struts2(-jQuery Plugin)标签的参数。

    您不能将一个 Struts2 标签放在另一个 Struts2 标签内;

    为此,您必须使用OGNL,对于URLs,您应该在网格标记之外定义URLs,并使用OGNL 引用它们,如下所示:

    <s:url id="myUrl" action="ProductInitialise" namespace="/myNamespace"/>
    

    ....

    onclick: function(){ load('%{myUrl}') } 
    

    假设所有其余部分都正常工作(例如 load 函数),这应该足以使其正常工作。

    【讨论】:

    • 嗨@Andrea Ligios 非常感谢。函数加载不起作用......但是我找到了另一个函数。“window.location = '%{myUrl}'”。现在可以了。 :) 谢谢你的帮助。
    猜你喜欢
    • 1970-01-01
    • 2016-09-04
    • 2015-03-31
    • 1970-01-01
    • 1970-01-01
    • 2019-05-27
    • 1970-01-01
    • 1970-01-01
    • 2013-10-31
    相关资源
    最近更新 更多