.前台代码

<%-- builed by manage.aspx.cmt [ver:2015.14.] at // :: --%>

<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="CcrCreditInputDataManage.aspx.cs" Inherits="HraWeb.CcrCreditInputDataManage" %>

<%@ Register Assembly="Trirand.Web" TagPrefix="asp" Namespace="Trirand.Web.UI.WebControls" %>
<%@ Register TagPrefix="a" Namespace="System.Runtime.Serialization" Assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" %> <!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="ceng" style="height: 100px;">
<div class="easyui-tabs" id="tabs" style="width: 100%; height: 10px;">
<div title="资产负债表" style="padding: 10px">
<div id="toolbar1" class="datagrid-toolbar">
<span class="title">公司名称1:</span><input type="text" id="txt_CompanyName1_LK_" name="txt_CompanyName1_LK_" class="input datacontrol" style="width: 200px" />
<a href="#" id="btn_add1" iconcls="icon-add" class="button add">新增</a>
<a href="#" id="btn_edit1" iconcls="icon-edit" class="button edit">编辑</a>
<a href="#" id="btn_del1" iconcls="icon-remove" class="button del">删除</a>
<a href="#" id="btn_search1" iconcls="icon-search" class="button search">查询</a>
<a href="#" id="btn_import1" iconcls="icon-import" class="button">导入</a>
<a href="#" id="btn_DelHistory1_" iconcls="icon-remove" class="button">删除历史数据</a>
</div>
</div>
<div title="收支利润表" style="padding: 10px">
<div id="toolbar2" class="datagrid-toolbar">
<span class="title">公司名称2:</span><input type="text" id="txt_CompanyName2_LK_" name="txt_CompanyName2_LK_" class="input datacontrol" style="width: 200px" />
<a href="#" id="btn_add2" iconcls="icon-add" class="button add">新增</a>
<a href="#" id="btn_edit2" iconcls="icon-edit" class="button edit">编辑1</a>
<a href="#" id="btn_del2" iconcls="icon-remove" class="button del">删除</a>
<a href="#" id="btn_search2" iconcls="icon-search" class="button search">查询</a>
<a href="#" id="btn_import2" iconcls="icon-import" class="button">导入</a>
<a href="#" id="btn_DelHistory2_" iconcls="icon-remove" class="button">删除历史数据</a>
</div> </div>
<div title="现金流量表" style="padding: 10px">
<div id="toolbar3" class="datagrid-toolbar">
<span class="title">公司名称3:</span><input type="text" id="txt_CompanyName3_LK_" name="txt_CompanyName_LK_" class="input datacontrol" style="width: 200px" />
<a href="#" id="btn_add3" iconcls="icon-add" class="button add">新增</a>
<a href="#" id="btn_edit3" iconcls="icon-edit" class="button edit">编辑</a>
<a href="#" id="btn_del3" iconcls="icon-remove" class="button del">删除</a>
<a href="#" id="btn_search3" iconcls="icon-search" class="button search">查询</a>
<a href="#" id="btn_import3" iconcls="icon-import" class="button">导入</a>
<a href="#" id="btn_DelHistory3_" iconcls="icon-remove" class="button">删除历史数据</a>
</div>
</div>
</div> </div>
<div>
<asp:JQGrid runat="server" ID="jq" Height="" MultiSelect="True" DataUrl="/CCR/CcrCompanyManage.aspx?_method=searchlist">
<Columns>
<asp:JQGridColumn DataField="CompanyName" Visible="true" HeaderText="公司名称" Frozen="True"></asp:JQGridColumn> <asp:JQGridColumn DataField="Id" Visible="false" PrimaryKey="true"></asp:JQGridColumn>
</Columns>
<ClientSideEvents LoadComplete="JDataGrid.loadComplete" />
</asp:JQGrid>
</div> </form>
<script language="javascript" type="text/javascript">
$(".easyui-tabs").width(screen.width * 0.878);
$(".easyui-tabs").height(ComputGridHeight());
var height = screen.height * 0.61; </script> <script type="text/javascript">
var jsonDic;
var parentId = "";
var jsonDic2;
var sel = false;
var url = "";
$(function () {
var tabs = $("#tabs").tabs().tabs('tabs');
var title = "";
for (var i = ; i < tabs.length; i++) {
///以下代码是为页签动态绑定单击事件
tabs[i].panel('options').tab.unbind().bind('click', { index: i }, function (e) {
title = ($(this).find(".tabs-title").html());
switch (title) {
case "资产负债表": source = "CcrBalanceSheet";
break;
case "收支利润表": source = "CcrIncomeStatement"; break;
case "现金流量表": source = "CcrCashFlowStatement"; break; } url = "/CCR/" + source + "Edit.aspx";
$.post("CcrCreditInputDataManage.aspx?_method=setDataUrl", {url:url,title:title}); form1.action = "/CCR/CcrCreditInputDataManage.aspx?_method=SetGridDataSource&source=" + source;
form1.submit();
});
} });
function PageOnLoad() {
InitDrop();
$("#ceng").height(ComputGridHeight()); url = "<%=Session["CcrCreditInputDataEditUrl"]%>"; var tabTitle = "<%=Session["CcrCreditInputDataTabTtile"]%>";
$("#tabs").tabs("select",tabTitle);
JDataGrid.InitGrid("jq", url, , , tabTitle, $(".add"), $(".edit"), $(".del"), $(".search"));
$("#jq").setGridHeight("");
$("#btn_search1").click(function () { var queryParams = $("body").GetSearchPostData();
var row = $("#txt_CompanyName2_LK_").combogrid("grid").datagrid("getSelected");
if (row != null) {
queryParams["txt_CompanyName_LK_"] = row.Id;
} else {
queryParams["txt_CompanyName_LK_"] = "";
} $("#tb1").jqGrid("setGridParam", { postData: queryParams, page: }).trigger("reloadGrid");
});
$("#btn_DelHistory1_").click(function () { //删除历史记录
PW.getWindow("/CCR/DelCcrCreditRawDataChoice.aspx", "删除历史数据", , );
});
$("#btn_DelHistory2_").click(function () { //删除历史记录
PW.getWindow("/CCR/DelCcrCreditRawDataChoice.aspx", "删除历史数据", , );
});
$("#btn_import1").click(function () { PW.getWindow("/CCR/CcrCreditRawDataUpFileManage.aspx", "上传", , );
});
$("#btn_import2").click(function () { PW.getWindow("/CCR/CcrCreditRawDataUpFileManage.aspx", "上传", , );
});
//控件按钮设置
$(".button").linkbutton({ plain: true });
}
function InitDrop() { UTIL.SetEntityCombo($("#txt_CompanyName2_LK_"), "CcrFundermental", "CompanyName", [[
{ field: 'Id', title: '客户id', align: 'left', width: },
{ field: 'CompanyName', title: '公司名称', width: }
]], null, "Id");
} </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 System.Text;
using DevExpress.XtraRichEdit.SpellChecker;
using HraModel.Sys.Enum;
using Trirand.Web.UI.WebControls; namespace HraWeb
{
public partial class CcrCreditInputDataManage : JQEntityManage<Contract.Domain.CcrCreditInputData>
{
private Spring.Caching.ICache cache;
private Spring.Caching.ICache SpringCache
{
get
{
if (cache == null)
cache = (Spring.Caching.ICache)ctx.GetObject("AspNetCache");
return cache;
}
set { cache = value; }
}
private void InitGrid(string entityName)
{
SpringCache.Remove("CcrCreditInputDataManage_JQ_SEL_TAB"+System.Environment.UserDomainName+System.Environment.UserName);
SpringCache.Insert("CcrCreditInputDataManage_JQ_SEL_TAB" + System.Environment.UserDomainName + System.Environment.UserName,entityName);
ArrayList colInfoList = GetTableInfo(ListAndTableExtension.ConvertToTableColumnName(entityName));
if (colInfoList != null && colInfoList.Count > )
{
int i = ;
foreach (dynamic c in colInfoList)
{
JQGridColumn col = new JQGridColumn();
col.DataField = ListAndTableExtension.ConvertToEntityColumnName(c.ColumnName);
col.HeaderText = c.Comments;
i++;
if (col.DataField != "Id")
jq.Columns.Add(col);
}
JQGridColumn cc = new JQGridColumn();
cc.DataField = "Id";
cc.Frozen = true;
cc.PrimaryKey = true;
cc.Visible = true;
cc.HeaderText = "PK";
jq.Columns.Insert(, cc); }
else
{
throw new Exception("表不存在或未定义任何列");
}
jq.DataUrl = string.Format("/CCR/CcrCreditInputDataManage.aspx?_method=search&source="+entityName,
entityName);
jq.ComputHeight = string.Empty;
jq.Height = ;
jq.Width = int.Parse((System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width * 0.6).ToString().Split('.')[]);
}
private ArrayList GetTableInfo(string tableName)
{
info = new Framework.QueryInfo();
info.Parameters.Add("table_name", tableName);
System.Data.DataSet ds = Holworth.Utility.HraUtility.EntityRowMapper.ExcuteDataSet("ETLColumn", info, Server.MapPath("~/config/ETL.xml"));
System.Collections.ArrayList list = new System.Collections.ArrayList();
for (var i = ; i < ds.Tables[].Rows.Count; i++)
{
var row = ds.Tables[].Rows[i];
var obj = new { Comments = string.IsNullOrEmpty(row["comments"].ToString()) ? row["column_name"].ToString() : row["comments"].ToString(), ColumnName = row["column_name"].ToString() };
list.Add(obj);
}
return list;
}
protected override void Page_Load(object sender, EventArgs e)
{ jq.ComputHeight = string.Empty;
jq.Height = ;
ArrayList list = GetTableInfo("CCR_BALANCE_SHEET");
StringBuilder sb = new StringBuilder();
sb.AppendLine("$(\"#tb3\").jqGrid({,");
sb.AppendLine("url:url,");
sb.AppendLine("datatype:\"json\",");
sb.AppendLine("width:\"90%\",");
sb.AppendLine("height:height,");
sb.AppendLine("colNames:[{0}" + "],");
sb.AppendLine("colModel:[{1}" + "],");
sb.AppendLine("viewrecords:true,");
sb.AppendLine("rowNum:25");
sb.AppendLine("rowList:[5,10,15]");
sb.AppendLine("pager:\"#gridPager1\"");
sb.AppendLine("ondblClickRow:function(rowid){} }).navGrid('#gridPager3', { edit: false, add: false, del: false });");
string colNames = "";
string colModels = "";
foreach (dynamic item in list)
{
colNames +="'"+ item.Comments.ToString().Split('-') []+ "'" + ","; } string s = sb.ToString();
foreach (dynamic item in list)
{
colModels += "{name:" +"'"+ item.ColumnName+"'" + "," + "index:" + "'" + item.ColumnName + "'"+"},\n"; } //给基类服务接口复制,可不付
//base.svc = Psvc;
if (!IsPostBack)
{ }
switch (Request["_method"])
{
case "SetGridDataSource":
InitGrid(Request["source"]);
break;
case "setDataUrl":
Session["CcrCreditInputDataEditUrl"] = Request["url"];
Session["CcrCreditInputDataTabTtile"] = Request["title"];
break;
}
base.Page_Load(sender, e);
} protected override void setDataSource()
{
if ((string.IsNullOrEmpty(info.QueryObject) && string.IsNullOrEmpty(info.CustomSQL)))
{ info.QueryObject = SpringCache.Get("CcrCreditInputDataManage_JQ_SEL_TAB" + System.Environment.UserDomainName + System.Environment.UserName).ToString(); }
if (svc == null)
{
info = Dao.FindByQueryInfo(info);
}
else
{
info = svc.FindByQueryInfo(info);
}
} /// <summary>
/// 设置查询条件或者语句
/// </summary>
/// <returns></returns>
protected override Framework.QueryInfo SetInfo()
{
info = base.SetInfo();
if (Request["_menuId"] == "")
{
info.AddParam("Purpose", ((int)SysEnum.CCR_Credit_Score_Training).ToString());
}
if (Request["_menuId"] == "")
{
info.AddParam("purpose", ((int)SysEnum.CCR_Credit_Score_Rating).ToString());
}
return info;
} }
}

easyui-tabs 页签绑定click事件,动态加载jqgrid的更多相关文章

  1. easyui tabs页签显示在底部属性

    data-options="tabPosition:'bottom'" 如果没有该属性  页签默认显示在最上面,效果如下 当加上了该属性  ,页签会出现在底部

  2. 移动端 vue + mintUI 实现头部页签切换,按需加载~

    记录~记录~~有时候,我们会遇到一个页面有两个页签切换需求,但是为了避免同时加载两个页面,我们要做到的就是当前进入的是那个页面,就先加载哪一个页面,并且也不会造成浏览器地址的变化.一开始我使用的方法是 ...

  3. jquery easyui使用(二)······可折叠面板动态加载无效果

    先上代码: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"& ...

  4. JQuery 动态加载 HTML 元素时绑定点击事件无效问题

    问题描述 假设项目中有一个列表页面,如下: 当点击列表一行数据可以显示详情页面,而详情页面的数据是根据当前行的数据作为参数,通过 ajax 请求到后台返回的数据,再根据返回的结果动态生成 html 页 ...

  5. js动态加载HTML元素时出现的无效的点击事件

    项目中列表数据中隐藏着详情数据, 图一: 详情数据是:根据当前行的数据作为参数,通过ajax请求到后台返回的数据,再根据返回的结果动态生成HTML页面 图二: js文件中的这些js的点击事件无效: j ...

  6. WinForms中动态给treeView的节点添加ContextMenuStrip,并绑定Click事件

    生成ContextMenuStrip var docMenu = new ContextMenuStrip(); ToolStripMenuItem deleteMenuItem = new Tool ...

  7. 二级ul li元素动态加载click事件

    一.代码 html代码: <ul class="id1" id="id1" style="width:84%; height:75%;overf ...

  8. jquery每次动态加载dom,绑定事件会多一次,

    jquery绑定事件,每次动态加载dom,绑定的事件会加1,比如动态加载dom5次,点那个点击事件会弹出5次 解决办法就是在每次绑定之前解绑定. $('.seek-footer .btn1').off ...

  9. jQuery-介绍 加载 选择器 样式操作 属性操作 绑定click事件

    jQuery - 介绍 加载 选择器 样式操作 属性操作 绑定click事件 注意:以下部分问题不能实现效果,因该是单词拼写错误(少个t)或者没有加引号(“swing”)... jquery介绍 jQ ...

随机推荐

  1. String类的一些常规方法

    String类 String类常用方法: ①length(): length()       长度    方法** 对比:数组.length      属性** 一般情况下,一个数字,一个字母,一个汉 ...

  2. 选择排序的JavaScript实现

    思想 原址比较的排序算法.即首先找到数结构中的最小值并将其放置在第一位,然后找到第二小的值将其放置在第二位...以此类推. 代码 function selectionSort(arr) { const ...

  3. mysql + unidac 使用事务例子

    //备注:mysql必须是使用innoDB引擎才支持事务功能,否则以下事务相关代码将失效.//SQL SERVER和Oracle还没试,明天回公司试了再发代码.procedure TForm1.btn ...

  4. (转)winform下UPD通信的简单应用

    本文转载自:http://blog.csdn.net/wanlong360599336/article/details/7557046 先看效果图: 使用UDP的好处就是不需要三次握手,但是缺点就是存 ...

  5. 微信JS-SDK实现自定义分享功能,分享给朋友,分享到朋友圈

    分享出去的内容,可以通过jssdk进行修改. 1.配置jssdk Wx_config.html <?php import("@.ORG.jssdk"); $jssdk = n ...

  6. PL/SQL 训练09--面向对象

    ---对象基本声明.实现.使用--对象类型,类似与JAVA中的类,通俗的讲,就是捆绑了相关函数和过程的记录类型. ---对象声明 --create type 创建一个对象类型的规范部分 create ...

  7. 13-js的面向对象

    创建对象的几种常用的方式 1 . 使用Object或对象字面量创建对象 2 . 工厂模式创建对象 3 . 构造函数模式创建对象 4 . 原型模式创建对象 1 . 使用Object或对象字面量创建对象 ...

  8. WebRTC相关的基础知识点

    这里主要用来记录自己整理的和webRTC相关的一些基本的知识点,后续整理的一些基础和零碎的知识点都会更新在这里.内容大部分来自于webRTC官网.w3c以及一些前辈们的博客中的文章和相关书籍等. 20 ...

  9. Libevent使用例子,从简单到复杂

    转载请注明出处:http://blog.csdn.net/luotuo44/article/details/39670221 本文从简单到复杂,展示如何使用libevent.网上的许多例子都是只有服务 ...

  10. C#使用 SharpAVI进行 屏幕录制

    再 nuget 中 搜索 shapAvi 并添加引用 github 地址:https://github.com/baSSiLL/SharpAvi using SharpAvi; using Sharp ...