jqgrid子表格
.前台
<%-- builed by manage.aspx.cmt [ver:2018.25.] at // :: --%> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TranProfitLossImpactManage.aspx.cs" Inherits="HraWeb.TranProfitLossImpactManage" %> <%@ Register Assembly="Trirand.Web" TagPrefix="asp" Namespace="Trirand.Web.UI.WebControls" %>
<%@ Register Src="~/Contols/Manage.ascx" TagName="Manage" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server"> <div id="toolbar" class="datagrid-toolbar">
<div class="panel-body" style="border: none; background: none; padding: 5px 20px;">
<div class="pull-right">
<div class="btn-group btn-group-sm">
<div class="input-group input-group-sm" style="width: 300px">
<div class="input-group-addon">名称</div>
<input type="text" id="txt_Name_LK_" name="txt_Name_LK_" class="datacontrol form-control" style="border-radius: 0px" />
<span class="input-group-btn">
<button class="btn btn-default " id="btn_search" type="button"><i class="fa fa-search"></i>查询</button>
</span>
</div>
</div>
</div>
</div>
</div>
<div class='jdataGrid'>
<table id="jq">
</table>
<div id="jq_pager">
</div>
<%-- <table id="jq_t">
</table>
<div id="jq_pgr">
</div>--%>
</div>
</form> <script type="text/javascript">
function bindSubGrid(subgrid_id, asofdate) {
var subgrid_table_id;
subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id var subgrid_pager_id;
subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id // (5)动态添加子报表的table和pager
$("#" + subgrid_id)
.html(
"<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
// (6)创建jqGrid对象
$("#" + subgrid_table_id)
.jqGrid(
{
url: 'TranProfitLossImpactManage.aspx?_method=loadbydate&asofdate=' + asofdate, // (7)子表格数据对应的url,注意传入的contact.id参数
datatype: "json",
page: ,
colNames: [ "合约号码", "合约名称", "计算方法", "计价货币", "上一日盯市价值", "当日盯市价值", "交易损益", "损益解释水平", "损益解释百分比", "总方差水平", "总方差百分比", "价格重估值", "利率重估值", "汇率重估值", "时间重估值", "关联度重估值", "价格归因", "利率归因", "汇率归因", "时间归因", "价格差值", "波动率差值", "利率差值", "汇率差值", "VEGAGAMMA归因", "交叉GAMMA归因", "交叉VEGAGAMMA归因", "DELTAVEGA归因", "波动率重估值", "波动率偏差重估值", "价格波动率重估值", "波动率归因", "波动率偏差归因", "价格波动率归因", "关联度归因", "价格方差", "波动率方差", "波动率偏差方差", "价格波动率方差", "利率方差", "汇率方差", "关联度方差", "时间方差", "新交易归因", "交易结算归因", "交易撤销归因", "交易修订归因", "价格重置归因", "期权执行归因", "DELTA归因", "GAMMA归因", "VEGA归因", "THETA归因", "RHO归因", "ETA归因", "Id"],
colModel: [ {
"name": "TransactionId",
"superFilterColumn": "TransactionId",
"searchoptions": { }, "index": "TransactionId"
},
{
"name": "TransactionName",
"superFilterColumn": "TransactionName",
"searchoptions": { }, "index": "TransactionName"
},
{
"name": "ComputeMethodId",
"superFilterColumn": "ComputeMethodId",
"searchoptions": { }, "index": "ComputeMethodId"
},
{
"name": "ValueCurrencyName",
"superFilterColumn": "ValueCurrencyName",
"searchoptions": { }, "index": "ValueCurrencyName"
},
{
"name": "PriorMtmValue",
"superFilterColumn": "PriorMtmValue",
"searchoptions": { }, "index": "PriorMtmValue"
},
{
"name": "CurrMtmValue",
"superFilterColumn": "CurrMtmValue",
"searchoptions": { }, "index": "CurrMtmValue"
},
{
"name": "ProfitLossValue",
"superFilterColumn": "ProfitLossValue",
"searchoptions": { }, "index": "ProfitLossValue"
},
{
"name": "PnlExplainedLevel",
"superFilterColumn": "PnlExplainedLevel",
"searchoptions": { }, "index": "PnlExplainedLevel"
},
{
"name": "PnlExplainedPercent",
"superFilterColumn": "PnlExplainedPercent",
"searchoptions": { }, "index": "PnlExplainedPercent"
},
{
"name": "TotalVarianceLevel",
"superFilterColumn": "TotalVarianceLevel",
"searchoptions": { }, "index": "TotalVarianceLevel"
},
{
"name": "TotalVariancePercent",
"superFilterColumn": "TotalVariancePercent",
"searchoptions": { }, "index": "TotalVariancePercent"
},
{
"name": "PriceRevaluation",
"superFilterColumn": "PriceRevaluation",
"searchoptions": { }, "index": "PriceRevaluation"
},
{
"name": "IrRateRevaluation",
"superFilterColumn": "IrRateRevaluation",
"searchoptions": { }, "index": "IrRateRevaluation"
},
{
"name": "FxRateRevaluation",
"superFilterColumn": "FxRateRevaluation",
"searchoptions": { }, "index": "FxRateRevaluation"
},
{
"name": "TimeRevaluation",
"superFilterColumn": "TimeRevaluation",
"searchoptions": { }, "index": "TimeRevaluation"
},
{
"name": "CorrRevaluation",
"superFilterColumn": "CorrRevaluation",
"searchoptions": { }, "index": "CorrRevaluation"
},
{
"name": "PriceImpact",
"superFilterColumn": "PriceImpact",
"searchoptions": { }, "index": "PriceImpact"
},
{
"name": "IrRateImpact",
"superFilterColumn": "IrRateImpact",
"searchoptions": { }, "index": "IrRateImpact"
},
{
"name": "FxRateImpact",
"superFilterColumn": "FxRateImpact",
"searchoptions": { }, "index": "FxRateImpact"
},
{
"name": "TimeImpact",
"superFilterColumn": "TimeImpact",
"searchoptions": { }, "index": "TimeImpact"
},
{
"name": "PriceDifferential",
"superFilterColumn": "PriceDifferential",
"searchoptions": { }, "index": "PriceDifferential"
},
{
"name": "VolatilityDifferential",
"superFilterColumn": "VolatilityDifferential",
"searchoptions": { }, "index": "VolatilityDifferential"
},
{
"name": "IrRateDifferential",
"superFilterColumn": "IrRateDifferential",
"searchoptions": { }, "index": "IrRateDifferential"
},
{
"name": "FxRateDifferential",
"superFilterColumn": "FxRateDifferential",
"searchoptions": { }, "index": "FxRateDifferential"
},
{
"name": "VegaGammaImpact",
"superFilterColumn": "VegaGammaImpact",
"searchoptions": { }, "index": "VegaGammaImpact"
},
{
"name": "CrossGammaImpact",
"superFilterColumn": "CrossGammaImpact",
"searchoptions": { }, "index": "CrossGammaImpact"
},
{
"name": "CrossVegaGammaImpact",
"superFilterColumn": "CrossVegaGammaImpact",
"searchoptions": { }, "index": "CrossVegaGammaImpact"
},
{
"name": "DeltaVegaImpact",
"superFilterColumn": "DeltaVegaImpact",
"searchoptions": { }, "index": "DeltaVegaImpact"
},
{
"name": "VolatilityRevaluation",
"superFilterColumn": "VolatilityRevaluation",
"searchoptions": { }, "index": "VolatilityRevaluation"
},
{
"name": "VolSkewRevaluation",
"superFilterColumn": "VolSkewRevaluation",
"searchoptions": { }, "index": "VolSkewRevaluation"
},
{
"name": "PriceVolRevaluation",
"superFilterColumn": "PriceVolRevaluation",
"searchoptions": { }, "index": "PriceVolRevaluation"
},
{
"name": "VolatilityImpact",
"superFilterColumn": "VolatilityImpact",
"searchoptions": { }, "index": "VolatilityImpact"
},
{
"name": "VolSkewImpact",
"superFilterColumn": "VolSkewImpact",
"searchoptions": { }, "index": "VolSkewImpact"
},
{
"name": "PriceVolImpact",
"superFilterColumn": "PriceVolImpact",
"searchoptions": { }, "index": "PriceVolImpact"
},
{
"name": "CorrImpact",
"superFilterColumn": "CorrImpact",
"searchoptions": { }, "index": "CorrImpact"
},
{
"name": "PriceVariance",
"superFilterColumn": "PriceVariance",
"searchoptions": { }, "index": "PriceVariance"
},
{
"name": "VolatilityVariance",
"superFilterColumn": "VolatilityVariance",
"searchoptions": { }, "index": "VolatilityVariance"
},
{
"name": "VolSkewVariance",
"superFilterColumn": "VolSkewVariance",
"searchoptions": { }, "index": "VolSkewVariance"
},
{
"name": "PriceVolVariance",
"superFilterColumn": "PriceVolVariance",
"searchoptions": { }, "index": "PriceVolVariance"
},
{
"name": "IrRateVariance",
"superFilterColumn": "IrRateVariance",
"searchoptions": { }, "index": "IrRateVariance"
},
{
"name": "FxRateVariance",
"superFilterColumn": "FxRateVariance",
"searchoptions": { }, "index": "FxRateVariance"
},
{
"name": "CorrVariance",
"superFilterColumn": "CorrVariance",
"searchoptions": { }, "index": "CorrVariance"
},
{
"name": "TimeVariance",
"superFilterColumn": "TimeVariance",
"searchoptions": { }, "index": "TimeVariance"
},
{
"name": "NewTranImpact",
"superFilterColumn": "NewTranImpact",
"searchoptions": { }, "index": "NewTranImpact"
},
{
"name": "SettledTranImpact",
"superFilterColumn": "SettledTranImpact",
"searchoptions": { }, "index": "SettledTranImpact"
},
{
"name": "CancelledTranImpact",
"superFilterColumn": "CancelledTranImpact",
"searchoptions": { }, "index": "CancelledTranImpact"
},
{
"name": "AmendedtranImpact",
"superFilterColumn": "AmendedtranImpact",
"searchoptions": { }, "index": "AmendedtranImpact"
},
{
"name": "PriceResetImpact",
"superFilterColumn": "PriceResetImpact",
"searchoptions": { }, "index": "PriceResetImpact"
},
{
"name": "OptionExerciseImpact",
"superFilterColumn": "OptionExerciseImpact",
"searchoptions": { }, "index": "OptionExerciseImpact"
},
{
"name": "DeltaImpact",
"superFilterColumn": "DeltaImpact",
"searchoptions": { }, "index": "DeltaImpact"
},
{
"name": "GammaImpact",
"superFilterColumn": "GammaImpact",
"searchoptions": { }, "index": "GammaImpact"
},
{
"name": "VegaImpact",
"superFilterColumn": "VegaImpact",
"searchoptions": { }, "index": "VegaImpact"
},
{
"name": "ThetaImpact",
"superFilterColumn": "ThetaImpact",
"searchoptions": { }, "index": "ThetaImpact"
},
{
"name": "RhoImpact",
"superFilterColumn": "RhoImpact",
"searchoptions": { }, "index": "RhoImpact"
},
{
"name": "EtaImpact",
"superFilterColumn": "EtaImpact",
"searchoptions": { }, "index": "EtaImpact"
},
{
"superFilterColumn": "Id",
"name": "Id", "searchoptions": {
"searchhidden": true
},
"hidden": true,
"key": true,
"index": "Id"
}
],
viewrecords: true,
scrollrows: false,
styleUI: 'Bootstrap',
jsonReader: { id: "Id" },
rowList : [ , , ],
rowNum: ,
sortorder: 'asc',
hidegrid: false,
height: ComputGridHeight(),
autowidth: true,
headertitles: true,
rownumbers: true,
shrinkToFit: false,
pager: jQuery('#' + subgrid_pager_id),
viewsortcols: [false, 'vertical', true] }); $("#"+subgrid_id).setGridWidth($(window).width() - ); }
function PageOnLoad() {
jQuery('#jq').jqGrid({
url: '/Tran/TranProfitLossImpactManage.aspx?_method=loadDate',
editurl: '/Tran/TranProfitLossImpactManage.aspx?_menuId=17264&jqGridID=jq&editMode=1',
datatype: 'json',
page: ,
colNames: ["运行日期"],
pageSize: ,
colModel: [
{ width: $(window).width() *0.9,
"name": "AsOfDate",
"formatter": getDate,
"index": "AsOfDate", }
],
viewrecords: true,
scrollrows: false,
styleUI: 'Bootstrap',
jsonReader: { id: "Id" },
rowNum: ,
sortorder: 'asc',
hidegrid: false,
width:,
height: ComputGridHeight(),
autowidth: true,
headertitles: true,
rownumbers: true,
shrinkToFit: false,
//pager: jQuery('#jq_pager'),
viewsortcols: [false, 'vertical', true],
loadComplete: JDataGrid.loadComplete,
subGrid: true,//开启子表格支持 //子表格的id;当子表格展开的时候,在主表格中会创建一个div元素用来容纳子表格,subgrid_id就是这个div的id
subGridRowExpanded: function (subgrid_id, row_id) {//子表格容器的id和需要展开子表格的行id var obj = $("#jq").jqGrid('getRowData', row_id);
bindSubGrid(subgrid_id, obj.AsOfDate); }
//,ondblClickRow: JDataGrid.rowDoubleClick });
$("#jq").setGridWidth($(window).width() - ); //控件按钮设置
$(".button").linkbutton({ plain: true });
//参数说明:控件Id,查询地址,编辑页面的宽度,高度,编辑页面标题,新增按钮,编辑按钮,删除按钮,查询按钮,查询回调函数
JDataGrid.InitGrid("jq", "/TranProfitLossImpact/TranProfitLossImpactEdit.aspx", , , "交易合约损益归因分析菜单管理", $("#btn_add"), $("#btn_edit"), $("#btn_del"), $("#btn_search"));
}
</script> </body>
</html> .后台
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HraWeb.Common;
using WebApp.Common;
using Contract.Domain;
using System.Collections;
using Framework;
using NHibernate.Linq; namespace HraWeb
{
public partial class TranProfitLossImpactManage : JQEntityManage<Contract.Domain.TranProfitLossImpact>
{
protected override void Page_Load(object sender, EventArgs e)
{
//给基类服务接口复制,可不付
//base.svc = Psvc;
if (!IsPostBack)
{ }
switch (Request["_method"])
{
case "loadDate":
var mRows = Dao.GetCurrentSession().QueryOver<TranProfitLossImpact>().List().Distinct(new TranProfitLossImpactDateDistinct()).ToList();
int count = mRows.Count;
JGridJson d = new JGridJson(, mRows, , count);
var json= Newtonsoft.Json.JsonConvert.SerializeObject(d);
Response.Write(json);
Response.End();
break;
case "loadbydate":
DateTime asofDate = DateTime.Parse(Request["asofdate"]);
int pageIndex = int.Parse(Request["page"]);
int pageSize = int.Parse(Request["rows"]);
var totalInfo = new QueryInfo();
totalInfo.CustomSQL = "select count(1) from tran_profit_loss_impact t where t.as_of_date=:as_of_date";
totalInfo.Parameters.Add("as_of_date", asofDate);
int totalRecordCount = ;
int.TryParse(Dao.ExecuteScare(totalInfo).ToString(), out totalRecordCount);
var mchildRows = Dao.GetCurrentSession().Query<TranProfitLossImpact>()
.Where(x=>x.AsOfDate==asofDate)
.Skip((pageIndex-)*pageSize)
.Take(pageSize)
.ToList();
int totalPage = ((totalRecordCount - ) / pageSize) + ;
int mchildcount = mchildRows.Count;
JGridJson cd = new JGridJson(totalPage, mchildRows, pageIndex, totalRecordCount);
var cjson = Newtonsoft.Json.JsonConvert.SerializeObject(cd);
Response.Write(cjson);
Response.End();
break;
default:
break;
}
base.Page_Load(sender, e);
} }
}
jqgrid子表格的更多相关文章
- jqGrid subGrid配置 如何首次加载动态展开所有的子表格
有时候需求需要默认加载表格的时候把子表格的数据也显示出来,经过研究相关SubGrids API配置如下: 属性 类型 描述 默认值 subGrid boolean 设置为true启用子表格.如果启用子 ...
- jqgrid嵌套子表格
jqgrid的subGrid子表格 jqGrid的一项高级功能就是嵌套子表格,使用起来也非常简单.使用的方式有两种: 使用普通的subGrid子表格: 使用一个完整jqGrid作为子表格: 1.选项含 ...
- jqGrid的subGrid子表格
使用完整jqGrid作为子表格 使用子表格,涉及到jqGrid的三个选项: subGrid :首先必须将jqGrid的subGrid选项设置为true,默认为false:当此项设为true的时候,Gr ...
- jqGrid多级表格的实现
原博主链接:http://blog.csdn.net/dreamstar613/article/details/54616503 jqGrid多级表格(可N级) 主要用的方法: subGridRowE ...
- 使用POI创建word表格-在表格单元格中创建子表格
要实现的功能如下:表格中的单元格中有子表格 实现代码如下: XWPFParagraph cellPara = row.getCell(j).getParagraphArray(0); //row.ge ...
- vue里使用elementUI里的下拉树表格,如何定义个性化的子表格?
最近项目写到一个业务,首先需要展示各类分组的基本信息,然后需要点击每个分组展示该分组下子的所有具体信息 一开始我是打算用tab来展示就是首先父分组的名称就是各个不同的tab按钮,然后点击按钮再展示不同 ...
- JqGrid 自定义子表格 及 自定义Json 格式数据不展示
项目第一次使用JqGrid ,发现功能强大,但由于对他不熟悉,也没有少走弯路,记录一下. 1.引用 <link href="~/Scripts/JqGrid/jqgrid/css/ui ...
- jqGrid数据表格
方式一: <!DOCTYPE html><html><head><meta charset="utf-8" /><title& ...
- JqGrid 显示表格
JqGrid 是前台的表格显示库,使用起来相当方便. 这里分享下本人使用过程中遇到的问题及解决方案 ** 一.rowNum属性 ** 1.如果不设置,默认显示数是20,也就是说超过20以后的数据.不再 ...
随机推荐
- maven 配置 阿里仓库
<mirror><id>nexus-aliyun</id><mirrorOf>central</mirrorOf><name>N ...
- msf客户端渗透(二):PDF漏洞、恶意网站、flash漏洞、IE漏洞、java漏洞、android漏洞、VBScript感染payload
这个漏洞利用只在XP上有效 利用pdf漏洞利用payload exploit生成一个pdf文件 传到被攻击机上 启动msf侦听 exploit -j XP上双击运行这个pdf时,kali获取到一个sh ...
- Bdfproxy
基于流量劫持动态注入shellcode 本机IP:192.168.1.113 靶机IP:192.168.1.114 先安装bdfproxy,mitmproxy,backdoor_factory 开启流 ...
- 【Nodejs】Node.js(Express)の環境構築
[Express]の環境 参考URL:http://expressjs.com/en/starter/generator.html ①Node.jsの準備 (参考URL:https://www.cnb ...
- WEB 自动化思路
前期做了一个关键字驱动模型的WEB自动化项目,特意写文章归纳和总结下. 框架架构图 已经实现的部分: 1. 读写excel数据模板 2.配置中心,支持properties,xml格式的配置文件 3.参 ...
- 像素 转换 px dp
public static int dip2px(Context context, float dpValue){ final float scale = context.getResources() ...
- C#后台对密码框不能直接赋值
当页面密码框 为 textmode="textpassword"时候,使用 txtpwd.text="XXX",是不会显示的, 应该使用txtpass.Attr ...
- 微信小程序开发——使用回调函数出现异常:TypeError: Cannot read property 'setData' of undefined
关键技术点: 作用域问题——回调函数中的作用域已经脱离了调用函数了,因此需要在回调函数外边把this赋给一个新的变量才可以了. 业务需求: 微信小程序开发,业务逻辑需要,需要把获取手机号码的业务逻辑作 ...
- JS参数转发
在没有装饰器之前不方便. 可以用Reflect.apply. cls = function f() { let obj = {}; obj.show = function(a, b) { consol ...
- Python: PySide(Qt)异步获取网页源码
学习PyQt UI编程笔记.相对PyQt来说,PySide资料为少. 此篇记录异步获取代码后,同步显示于界面窗体中,涉及线程网步,此为知识点. 直录代码: # encoding: utf-8 from ...