javascript - 自定义格式显示列标签
问题描述
伙计们,我在我的 jsp 页面中使用显示标签,我试图在显示列标签中使用格式选项,但它不起作用,我如何格式化列标签?有关更多信息,请查看下面的代码。感谢任何帮助。
<div>
<display:table name="displayStudent" id="displayStudent" requestURI="">
<display:column property="name" title="name" format="nameFormatter()"/> //using format option here
</display:table>
</div>
//this is a format function
function nameFormatter(rowid, cellValue, colModel, rowData){
if(cellValue="hen" || cellValue="den"){
return "style=color:red";
}
}
//I used this but I am getting red color in all vaues of a column, Ijust need red color in column with value 'hen' and 'den'
<c:choose>
<c:when test="${name=='hen' || name='den'}">
<display:column property="name" title="name" style="color:red" format="nameFormatter()"/>
</c:when>
<c:otherwise>
<display:column property="name" title="name" format="nameFormatter()"/>
</c:otherwise>
</c:choose>
解决方案
推荐阅读
- swift4 - arkit 场景视图仅显示 1 个 arkit 对象
- python - 我需要每次都写 decode() 来打印数据吗
- dialog - 从带有 SlickGrid 表的对话框中返回选定的行
- php-carbon - laravel carbon 从时间戳比较两个时区时间
- c++ - 没有“/”怎么做除法?
- sql-server - 如何修复“不存在从对象类型 System.Data.SqlClient.SqlParameter 到已知托管提供程序本机类型的映射。” ASP.Net 中的错误
- c++ - 我正在尝试在 ALLEGRO c++ 中使用许多墙壁进行整理
- sql - Athena:按比例查询耗尽的资源
- algorithm - 绘制手写文本的算法
- c# - 来自不同线程的 C# WPF 动画