自设table表格,获取内容,并经弹出框的url传参,获取结果显示在弹出框,并加载合计

table表格,选择框

form id="editForm1">
<table class="table_form">
<td >经济性质:</td>
<td >
<input width="150" type="text" id="nature_id" readonly onclick="show_nature()">
<input type="hidden" name="nature_name">
</td>
</tr>
<tr><td colspan="3">请选择统计类型:</td></tr>
<tr>
<td align="right">
<input type="radio" class="" name="rblViewStyle" value="1" checked="checked" class="mini-textboxlist">全口径
</td>
<td align="right">
<input type="radio"class="" name="rblViewStyle" value="2" class="mini-textboxlist">区级分成
</td>
</tr>
<tr>
<td colspan="3" align="center">
<a class="btn_color_1" id="BtnSaveBack1" onclick=" chaxun(0);"><i class="fa fa-save"></i> 查询</a>
</td>
</tr>
</table>
</form>

弹出框,结果显示

<div id="editWindow1" class="mini-window" title="国地税分部门纳税统计" style="width:1400px; height :600px;" showModal="true" allowResize="true" allowDrag="true">
<div id="grid" class="mini-datagrid" style="width: 100%; height: 100%; border:0;" dataField="rows" url="${ctx}/tAXPAYTAXEXTOTAL/gdHZ_dept" autoload="false" allowresize="false" sortField="ID"
sortOrder="asc" pagesize="100" allowalternating="true" multiselect="true" onload="onLoad">
</div>
</div>

点击查询,进入chaxun(0)方法

获取输入框中的内容
var nature_name=$('#nature_id').val();
rblViewStyle=($("[name='rblViewStyle']:checked").val());
//将数据放在_SearchData中
var _SearchData = {}; _SearchData = $.extend(_SearchData, mini.decode("{'nature_name':'" + nature_name + "'}"));
_SearchData = $.extend(_SearchData, mini.decode("{'rblViewStyle':'" + rblViewStyle + "'}"));
//先加载弹出框
editWindow1.show();
加载弹出框中表格的内容
grid.set({
columns: [
{ field: "TOWN", width: 140,align: "center", headerAlign: "center", allowSort: true, header: "所属镇办" },
]
});
//再执行弹出框grid中的url,并将数据传给后台,获取结果后将内容给弹出框
grid.load(_SearchData);

弹出框中有onload="onLoad"属性,加载onLoad()方法,添加合计新行

function onLoad(e) {
var index = grid.getData().length;
var row= {"TOWN": "合计", "ZCDJLX": "","MONEY_ALL": ""};
//添加新行
grid.addRow(row, index);
//对index行,从第1列占位(合并)1行2列
var marges = [
{ rowIndex: index, columnIndex: 1, rowSpan: 1, colSpan: 2},
];
grid.mergeCells(marges);//进行合并 var grids = e.sender;
var MONEY_ALL=0;
var length=grids.data.length;
//对每行内容进行相加
for (var i = 0; i <length; i++) {
MONEY_ALL =MONEY_ALL+( grids.data[i].MONEY_ALL =="" ? 0 : parseFloat(grids.data[i].MONEY_ALL));
}
//修改该行
grid.updateRow(row, { "MONEY_ALL": MONEY_ALL}); }
上一篇:Java线程新特性--- Lock


下一篇:分形之城(分形)