jQuery MiniUI

 找回密码
 立即注册
查看: 4202|回复: 1
打印 上一主题 下一主题

tmpl真心不会用,数据就是不出来来 [复制链接]

Rank: 2

跳转到指定楼层
楼主
发表于 2014-8-7 12:10:55 |只看该作者 |倒序浏览
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="${pageContext.request.contextPath}/ui/css/ys.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath}/ui/scripts/boot.js" type="text/javascript"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ui/js/public/public.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ui/scripts/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/ui/scripts/jquery.tmpl.js"></script>
<style type="text/css">
.errorText {
        color: red;
}
html,body
    {
        width:100%;
        height:100%;
        border:0;
        margin:0;
        padding:0;
       overflow:hidden;
    }
</style>
<title></title>
</head>
<body>
        <div style="width: 100%;" id="searchForm">
                <table id="tbl1" style="width: 100%;">
                        <tr>
                                <td style="white-space: nowrap;">
                                        <label style="font-weight: bolder;">
                                                项目编码:
                                        </label>
                                        <input id="p_code" class="mini-textbox"/>&nbsp;&nbsp;
                                        <label style="font-weight: bolder;">项目名称:</label>
                                        <input id="p_name" class="mini-textbox"/>
                                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                <label style="font-weight: bolder;">专业类别:</label>
                                                <input id="p_type" allowInput="true" class="mini-textbox"/>&nbsp;&nbsp;
                                               
                                                <label style="font-weight: bolder;">
                                                        计划年度:
                                                </label>
                                                <input id="date1" class="Wdate" size="5" width="1px" value=""/>年
                                                &nbsp;
                                                至
                                                &nbsp;
                                                <input id="date2" class="Wdate" size="5" width="1px" value=""/>年
                                </td>
                                <td align="right"><a class="mini-button"
                                        iconCls="icon-search" style="width: 60px;">查询</a> <a
                                        onclick="reset()" class="mini-button" iconCls="icon-redo"
                                        style="width: 60px;">重置</a></td>
                        </tr>
                </table>
               
                <div class="mini-toolbar" style=" width: 100%;border-bottom: 0; padding: 0px;">
                        <table style="width: 100%;">
                        <tr>
                                <td align="left">
                                        <label id="statistics_time" style="font-weight: bolder;">统计时间:-年 - -年</label>
                                </td>
                                <td align="right"><label style="font-weight: bolder;">单位:万元、%</label></td>
                        </tr>
                </table>
                </div>
        </div>
        <div class="mini-fit">
                <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%"
                        multiSelect="true" url="${pageContext.request.contextPath}/budget/proPlanQuery/pageInfo"
                         allowRowSelect="false" enableHotTrack="false"
                onshowrowdetail="onShowRowDetail" autoHideRowDetail="false">
                        <div property="columns">
                                <div type="expandcolumn"></div>
                                <div type="indexcolumn" align="center" headerAlign="center">行次</div>
                                <div field="year" width="80" align="center" headerAlign="center" allowSort="true">计划年度</div>
                                <div field="p_code" align="left" width="150" headerAlign="center" allowSort="true">项目编码</div>
                                <div field="p_name" width="80" align="left" headerAlign="center" allowSort="true">项目名称</div>
                                <div field="p_dw_name" width="80" align="center" headerAlign="center" allowSort="true">项目所属单位</div>
                                <div field="p_type" width="90" align="center" headerAlign="center" allowSort="true">专业类别</div>
                                <div field="p_content" width="120" align="center" headerAlign="center" allowSort="true">项目内容</div>
                                <div field="begin_year" width="110" align="center" headerAlign="center" allowSort="true" dateFormat="yyyy-MM-dd">项目开始日期</div>
                                <div field="end_year" width="120" align="center" headerAlign="center" allowSort="true" dateFormat="yyyy-MM-dd">项目结束日期</div>
                                <div field="budget_all" width="100" align="right" headerAlign="center" allowSort="true">总预算</div>
                                <div field="pay_lastyear" width="120" align="right" headerAlign="center" allowSort="true">上年累计完成</div>
                                <div field="budget_year" width="110" align="right" headerAlign="center" allowSort="true">本年计划预算</div>
                        </div>
                </div>
        </div>
        <style type="text/css">
.detailForm td
{
    line-height:22px;
    font-size:13px;
    font-family:Verdana;
}
</style>
<script id="formTemplate" type="text/x-jquery-tmpl">
        <table class="detailForm" style="width:100%;">
            <tr>
                <td style="width:80px;">计划年度:</td>
                <td style="width:150px;">${YEAR}</td>
                <td style="width:80px;">项目编码:</td>
                <td style="width:150px;">${p_code}</td>
                <td style="width:80px;">项目名称:</td>
                <td style="width:150px;">${p_name}</td>
                <td style="width:80px;">项目所属单位:</td>
                <td style="width:150px;">${p_dw_name_name}</td>
                </tr>
            <tr>
                <td style="width:80px;">专业类别:</td>
                <td style="width:150px;">${p_type}</td>
                <td style="width:80px;">项目开始日期:</td>
                <td style="width:150px;">${begin_year}</td>
                        <td style="width:80px;">项目结束日期:</td>
                <td style="width:150px;">${end_year}</td>
                        <td style="width:80px;">总预算:</td>
                        <td style="width:150px;">${budget_all}</td>
                </tr>
            <tr>
                        <td style="width:80px;">上年累计完成:</td>
                <td style="width:150px;">${pay_lastyear}</td>
                        <td style="width:80px;">本年计划预算:</td>
                <td style="width:150px;">${budget_year}</td>
                        <td style="width:80px;">项目内容:</td>
                <td style="width:150px;">${p_content}</td>
                       
            </tr>
        </table>

</script>
        <script type="text/javascript">
        function removeRow() {
        grid.removeRow(0);
    }
                mini.parse();
                var grid = mini.get("datagrid1");
                grid.load();
                grid.sortBy("", "desc");
               
             //调用
                 function onShowRowDetail(e) {
                                 var grid = e.sender;
                    var row = e.record;
                    var td = grid.getRowDetailCellEl(row);
                $.ajax({
                        type:"post",
                    url: "${pageContext.request.contextPath}/budget/proPlanQuery/findProPlanQueryById",
                    data:{
                            p_code:row.p_code,
                            year:row.year
                    },
                    success: function (text) {
                        var o = mini.decode(text);
                        o.begin_year = mini.formatDate(o.begin_year, "yyyy-MM-dd");
                        o.end_year=mini.formatDate(o.end_year, "yyyy-MM-dd");
                        o.create_time = mini.formatDate(o.create_time, "yyyy-MM-dd");
                        o.update_time=mini.formatDate(o.update_time, "yyyy-MM-dd");
                        td.innerHTML = "";
                        $("#formTemplate").tmpl(o).appendTo(td);
                    }
                });
        }

                function search() {
                        var d1 = $("#date1").val();
                        var d2 = $("#date2").val();;
                        var p_code=mini.get("p_code").getValue();
                        var p_name=mini.get("p_name").getValue();
                        var p_type=mini.get("p_type").getValue();
                        if(d1!=''||d2!=''){
                                $("#statistics_time").html("统计时间:" +d1+ "年  至 "+d2+"年");
                        }
                        grid.load({p_code:p_code,p_name:p_name,p_type:p_type,d1:d1,d2:d2 });
                }

                function reset() {
                        $(".Wdate").val("");
                        var f = new mini.Form("searchForm");
            f.reset();
                }
        </script>
</body>
</html>



附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册

Rank: 8Rank: 8

沙发
发表于 2014-8-7 13:53:08 |只看该作者
是不是你的数据格式不对
用写死的数据试试有没有绑上去
var o={YEAR:"111",p_code:"2222"}
$("#formTemplate").tmpl(o).appendTo(td);

Archiver|普加软件

GMT+8, 2025-7-21 00:19 , Processed in 1.032508 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部