gpt4 book ai didi

java - 如何自定义grid jquery struts2插件添加超链接

转载 作者:行者123 更新时间:2023-11-27 22:41:20 25 4
gpt4 key购买 nike

我要去用户网格显示数据。我正在看下面的例子。 http://struts.jgeppert.com/struts2-jquery-grid-showcase/index.action就像第一个例子一样,我想简单地填充数据没有编辑没有内联编辑导航按钮我只想添加 2 个包含超链接的列") >编辑") >更新

在文档中也没有明确提到这一点。

请告诉我应该怎么做?

谢谢

最佳答案

您可以向该列添加格式化函数。

 <@sjg.gridColumn 
name="name"
index="name"
title="Name"
sortable="true"
align="center"
formatter="nameFormatter"
search="true"
searchoptions="{sopt:['cn']}"
/>

然后您可以像这样定义一个小的 javascript 函数 nameFormatter:

function nameFormatter(cellvalue,options,row) {
return '<a href="your_link?id=' + row.someId +">' + cellvalue + '</a>';
}

其中 cellvalue 是原始单元格的实际名称,而 row.someId 是,例如,您从另一列获得的一些 id。这将导致类似于:

<a href="your_link?id=34">Foo</a>

希望对你有帮助

关于java - 如何自定义grid jquery struts2插件添加超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10756118/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com