首页 > 解决方案 > 自定义格式显示列标签

问题描述

伙计们,我在我的 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>

标签: javascriptjqueryjspjstldisplaytag

解决方案


推荐阅读