2

输出:

在此处输入图像描述

在 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>
4

1 回答 1

1

Basing on what I've discovered in this answer, you could easily use a custom Formatter:

<script>
  function freshFormatter(cellValue, options, rowObject) {
       return cellValue.split(',').join('<br/>');
   }
</script>

<sjg:gridColumn name = "fresh" 
                  id = "fresh" 
               title = "Fresh" 
           formatter = "freshFormatter" />
于 2014-04-15T10:17:12.777 回答