ReportViewer2010冻结行列
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewTrackingVer.aspx.cs"
Inherits="GeoOilRes.RDLC.NewTrackingVer" %> <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!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>
<script src="../../Scripts/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="../Scripts/rdlc-function.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var ReportTable = $('#VisibleReportContentReportViewer1_ctl10');
if (ReportTable.html().length > 0 ) {
var w = pageWidth();
var h = pageHeight();
var tableID = "RdlcTable";
$('#VisibleReportContentReportViewer1_ctl10 table table table table:last').attr("ID", tableID);
freezeTable(tableID, 5, 4, w, h);
var flag = false;
$(window).resize(function () {
if (flag)
return;
setTimeout(function () {
adjustTableSize(tableID, w, h);
flag = false;
}, 100);
flag = true;
});
}
});
</script>
</head>
<body style="padding: 0; margin: 0; overflow: hidden; background-color: white;">
<form id="form1" runat="server" style="text-align: left;">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
<ContentTemplate>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
InteractiveDeviceInfos="(集合)" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"
Width="100%" Height="100%" ShowToolBar="true" ShowBackButton="False" ShowFindControls="False"
ShowRefreshButton="False" HyperlinkTarget="_self">
</rsweb:ReportViewer>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ReportViewer1" />
</Triggers>
</asp:UpdatePanel>
</form>
</body>
</html>
/*
* 锁定表头和列
*
* 参数定义
* table - 要锁定的表格元素或者表格ID
* freezeRowNum - 要锁定的前几行行数,如果行不锁定,则设置为0
* freezeColumnNum - 要锁定的前几列列数,如果列不锁定,则设置为0
* width - 表格的滚动区域宽度
* height - 表格的滚动区域高度
*/
function freezeTable(table, freezeRowNum, freezeColumnNum, width, height) {
freezeRowNum += 1;
freezeColumnNum += 1;
if (typeof (freezeRowNum) == 'string')
freezeRowNum = parseInt(freezeRowNum) if (typeof (freezeColumnNum) == 'string')
freezeColumnNum = parseInt(freezeColumnNum) var tableId;
if (typeof (table) == 'string') {
tableId = table;
table = $('#' + tableId);
} else
tableId = table.attr('id'); var divTableLayout = $("#" + tableId + "_tableLayout"); if (divTableLayout.length != 0) {
divTableLayout.before(table);
divTableLayout.empty();
} else {
table.after("<div id='" + tableId + "_tableLayout' style='overflow:hidden;height:" + height + "px; width:" + width + "px;'></div>"); divTableLayout = $("#" + tableId + "_tableLayout");
} var html = '';
if (freezeRowNum > 0 && freezeColumnNum > 0)
html += '<div id="' + tableId + '_tableFix" style="padding: 0px;"></div>'; if (freezeRowNum > 0)
html += '<div id="' + tableId + '_tableHead" style="padding: 0px;"></div>'; if (freezeColumnNum > 0)
html += '<div id="' + tableId + '_tableColumn" style="padding: 0px;"></div>'; html += '<div id="' + tableId + '_tableData" style="padding: 0px;"></div>'; $(html).appendTo("#" + tableId + "_tableLayout"); var divTableFix = freezeRowNum > 0 && freezeColumnNum > 0 ? $("#" + tableId + "_tableFix") : null;
var divTableHead = freezeRowNum > 0 ? $("#" + tableId + "_tableHead") : null;
var divTableColumn = freezeColumnNum > 0 ? $("#" + tableId + "_tableColumn") : null;
var divTableData = $("#" + tableId + "_tableData"); divTableData.append(table); if (divTableFix != null) {
var tableFixClone = table.clone(true);
tableFixClone.attr("id", tableId + "_tableFixClone");
divTableFix.append(tableFixClone);
} if (divTableHead != null) {
var tableHeadClone = table.clone(true);
tableHeadClone.attr("id", tableId + "_tableHeadClone");
divTableHead.append(tableHeadClone);
} if (divTableColumn != null) {
var tableColumnClone = table.clone(true);
tableColumnClone.attr("id", tableId + "_tableColumnClone");
divTableColumn.append(tableColumnClone);
} $("#" + tableId + "_tableLayout table").css("margin", "0"); if (freezeRowNum > 0) {
var HeadHeight = 0;
var ignoreRowNum = 0;
$("#" + tableId + "_tableHead tr:lt(" + freezeRowNum + ")").each(function () {
if (ignoreRowNum > 0)
ignoreRowNum--;
else {
var td = $(this).find('td:first, th:first');
HeadHeight += td.outerHeight(true); ignoreRowNum = td.attr('rowSpan');
if (typeof (ignoreRowNum) == 'undefined')
ignoreRowNum = 0;
else
ignoreRowNum = parseInt(ignoreRowNum) - 1;
}
});
HeadHeight += 2; divTableHead.css("height", HeadHeight);
divTableFix != null && divTableFix.css("height", HeadHeight);
} if (freezeColumnNum > 0) {
var ColumnsWidth = 0;
var ColumnsNumber = 0;
$("#" + tableId + "_tableColumn tr:eq(" + freezeRowNum + ")").find("td:lt(" + freezeColumnNum + "), th:lt(" + freezeColumnNum + ")").each(function () {
if (ColumnsNumber >= freezeColumnNum)
return; ColumnsWidth += $(this).outerWidth(true); ColumnsNumber += $(this).attr('colSpan') ? parseInt($(this).attr('colSpan')) : 1;
});
ColumnsWidth += 2; divTableColumn.css("width", ColumnsWidth);
divTableFix != null && divTableFix.css("width", ColumnsWidth);
} divTableData.scroll(function () {
divTableHead != null && divTableHead.scrollLeft(divTableData.scrollLeft()); divTableColumn != null && divTableColumn.scrollTop(divTableData.scrollTop());
}); divTableFix != null && divTableFix.css({ "overflow": "hidden", "background-color": "white", "position": "absolute", "z-index": "50" });
divTableHead != null && divTableHead.css({ "overflow": "hidden", "background-color": "white", "width": width - 17, "position": "absolute", "z-index": "45" });
divTableColumn != null && divTableColumn.css({ "overflow": "hidden", "background-color": "white", "height": height - 17, "position": "absolute", "z-index": "40" });
divTableData.css({ "overflow": "scroll", "width": width, "height": height, "position": "absolute" }); divTableFix != null && divTableFix.offset(divTableLayout.offset());
divTableHead != null && divTableHead.offset(divTableLayout.offset());
divTableColumn != null && divTableColumn.offset(divTableLayout.offset());
divTableData.offset(divTableLayout.offset());
} /*
* 调整锁定表的宽度和高度,这个函数在resize事件中调用
*
* 参数定义
* table - 要锁定的表格元素或者表格ID
* width - 表格的滚动区域宽度
* height - 表格的滚动区域高度
*/
function adjustTableSize(table, width, height) {
var tableId;
if (typeof (table) == 'string')
tableId = table;
else
tableId = table.attr('id'); $("#" + tableId + "_tableLayout").width(width).height(height);
$("#" + tableId + "_tableHead").width(width - 17);
$("#" + tableId + "_tableColumn").height(height - 17);
$("#" + tableId + "_tableData").width(width).height(height);
} function pageHeight() {
if ($.browser.msie) {
return document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight : document.body.clientHeight;
} else {
return self.innerHeight;
}
}; //返回当前页面宽度
function pageWidth() {
if ($.browser.msie) {
return document.compatMode == "CSS1Compat" ? document.documentElement.clientWidth : document.body.clientWidth;
} else {
return self.innerWidth;
}
};
ReportViewer2010冻结行列的更多相关文章
- 任务三十九:UI组件之冻结行列表格
任务三十九:UI组件之冻结行列表格 面向人群: 有一定JavaScript基础 难度: 中 重要说明 百度前端技术学院的课程任务是由百度前端工程师专为对前端不同掌握程度的同学设计.我们尽力保证课程内容 ...
- poi的合并单元格和冻结行列
//创建工作薄(excel) Workbook wb = new HSSFWorkbook(); //创建sheet Sheet createSheet = wb.createSheet(" ...
- excel2010冻结行列
https://jingyan.baidu.com/article/a24b33cd56f6bd19ff002b7c.html
- 【jQuery 冻结任意行列】冻结任意行和列的jQuery插件
实现原理: 创建多个div,div之间通过css实现层叠,每个div放置当前表格的克隆.例如:需要行冻结时,创建存放冻结行表格的div,通过设置z-index属性和position属性,让冻结行表格在 ...
- C#组件系列——又一款Excel处理神器Spire.XLS,你值得拥有(二)
前言:上篇 C#组件系列——又一款Excel处理神器Spire.XLS,你值得拥有 介绍了下组件的两个功能,说不上特色,但确实能解决我们项目中的一些实际问题,这两天继续研究了下这个组件,觉得有些功能用 ...
- Apache POI使用详解
Apache POI使用详解 1.POI结构与常用类 (1)POI介绍 Apache POI是Apache软件基金会的开源项目,POI提供API给Java程序对Microsoft Office格式档案 ...
- Spire.XLS
又一款Excel处理神器Spire.XLS,你值得拥有(二) 前言:上篇 C#组件系列——又一款Excel处理神器Spire.XLS,你值得拥有 介绍了下组件的两个功能,说不上特色,但确实能解决我 ...
- POI使用详解
Apache POI使用详解 1.POI结构与常用类 (1)POI介绍 Apache POI是Apache软件基金会的开源项目,POI提供API给Java程序对Microsoft Office格式档案 ...
- FineReport填报分页设置
1. 问题描述 进行FineReport数据填报时,如果数据量过大,由于前端浏览器的性能限制,如果将数据全部展现出来,速度会非常的慢,影响用户体验,这时候大家就会想,填报是否能像分页预览一样进行分页呢 ...
随机推荐
- php 4.X与5.x版本构造函数区别与类的继承
今天看ecshop源码的时候发现 构造函数是和类名一样,以前没接触过,一下子疑惑啦 HP4.x 版本: PHP 4.x 的构造函数名与类名相同. 注意:在子类里父类的构造函数不会自动执行 ...
- · HTML使用Viewport
· HTML使用ViewportViewport可以加速页面的渲染,请使用以下代码<meta name=”viewport” content=”width=device-width, initi ...
- python运维开发之第三天
一.第二天课程的复习总结 1.列表可以增删改查,元组是不可修改的列表,字符串是不可以修改的. 2.列表,元组是有序的,字典是无序的,字典的key唯一 3.列表字典可以嵌套列表,可以嵌套字典,可以嵌套多 ...
- typedef , static和 extern
typedef 1.作用:给已经存在的类型起一个新的名称 2.使用场合: 1> 基本数据类型 2> 指针 3> 结构体 4> 枚举 5> 指向函数的指针 #include ...
- GIve Me A Welcome Hug!
类似于初来乍到,和大家打个招呼,并矫情的希望路人也能回赠我一个welcome hug. 到了这种园子那一定是做CS相关的了,一直以为如果能够坚持写技术博客,那一定会对自己的内力有十足的提升.借用一位前 ...
- 打印机PCL漏洞原理分析
0x01 漏洞概要 PCL代表打印机控制语言(Printer Control Language),由惠普公司开发,并被广泛使用的一种打印机协议.关于另一种页面描述语言,应该提一提由Adobe设计的Po ...
- 不用预计算切向空间的Normal mapping
先贴出shader 吧 等有时间了 来阐述原理 // vertex shader //varying vec3 ViewPosition; //varying vec3 Normal; varying ...
- Floyd 算法 打印路径模板
#include <iostream> #include <cstdlib> #include <cstdio> #include <algorithm> ...
- mongodb清洗数据
1,数据库连接超时:DBPool的连接时的配置: 自己进行设置: MongoClientOptions mco = new MongoClientOptions.Builder() ...
- Linux项目一
Linux项目一 引言: 这是我去年做的东西,一直没有时间整理,今天又要做一个基于这个项目的客户端与服务器版本. 以前我写的库文件中的函数耦合度很大,在一个函数中调用另一个函数,导致一无法拆开使用! ...