输出:
在Fresh列中有0.0,0.0,0.0是3列输出我将从Servlet连接到jsp。 在网格表中,我想逐行显示..
Fresh
__________
0.0
0.0
0.0
___________
0.0
0.0
0.0
___________
喜欢那个......
怎么做?
我的Jsp页面:
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head jqueryui="true" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<font size="4px">
<s:form id="chq_col_cancel" name="chq_col_cancel" theme="simple"
action="chq_cancel">
<table width="200px">
<tr align="center">
<td colspan="2">Branch: <s:url id="remoteurl" action="jsonsample" />
<s:select href="%{remoteurl}" id="branch" onchange="view(this)"
name="branch" list="{'2','3'}" headerKey="1"
headerValue="Select Branch" cssStyle="width:150px; height:22px"/>
</td>
</tr>
<tr>
<td colspan="2">
<s:url id="remoteurl" action="finance_yr_fa" />
<sjg:grid id="gridtable"
caption="Finance Year Details"
dataType="json"
loadonce="true"
href="%{remoteurl}"
gridModel="finYr_grid"
cssStyle="font-size:10px" pager="true"
rowList="25,50,75"
rowNum="0" rownumbers="true"
viewrecords="true"
width="600" height="500"
onSelectRowTopics="goFields"
userDataOnFooter="true">
<sjg:gridColumn name="fa_code" id="fa_code" title="fa_code" />
<sjg:gridColumn name="pk" id="pk" title="PK" />
<sjg:gridColumn name="fresh" id="fresh" title="Fresh" />
<sjg:gridColumn name="renewal" id="renewal" title="Renewal" />
<sjg:gridColumn name="total" id="total" title="Total" />
<sjg:gridColumn name="incentive" id="incentive" title="Incentive" />
<sjg:gridColumn name="bpi" id="bpi" title="BPI" />
<sjg:gridColumn name="panno" id="panno" title="panno" />
<sjg:gridColumn name="pr" id="pr" title="PR" />
</sjg:grid></td>
</tr>
</table>
</s:form>
</font>
</body>
</html>
答案 0 :(得分:1)
根据我在this answer中发现的内容,您可以轻松使用自定义格式化程序:
<script>
function freshFormatter(cellValue, options, rowObject) {
return cellValue.split(',').join('<br/>');
}
</script>
<sjg:gridColumn name = "fresh"
id = "fresh"
title = "Fresh"
formatter = "freshFormatter" />