环境:VS2019、VB.NET、Spread for ASP.NET 10.0
现象:数据行20条时,行单选机能正常,
数据行过大时(500),行单选后,7-8秒才反应
★机能不能使用分页
前台页面
TestDemo.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestDemo.aspx.vb" Inherits="CheckBoxCellDemo.TestDemo" %>
<%@ Register Assembly="FarPoint.Web.Spread" Namespace="FarPoint.Web.Spread" TagPrefix="FarPoint" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script language="javascript" type="text/javascript" src="js/jquery-3.4.1.js"></script>
<script language="javascript" type="text/javascript">
window.onload = init;
var spHeader;
var spDetail;
function init() {
spHeader = document.getElementById("spHeader");
}
function spHeader_MoveClick() {
var row;
if (document.all) {
row = spHeader.ActiveRow;
}
else {
row = spHeader.GetActiveRow();
}
for (var i = 0; i < spHeader.GetRowCount(); i++) {
if (i == row) {
continue;
}
else {
spHeader.SetValue(i, 0, false, true);
}
}
for (var i = 0; i < spDetail.GetRowCount(); i++) {
spDetail.SetValue(i, 0, false, true);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<aspanel ID="anel1" runat="server">
行数:
<asp:RadioButton ID="rdo50" runat="server" Text="20" GroupName="rowCount" AutoPostBack="true"/>
<asp:RadioButton ID="rdo500" runat="server" Text="500" GroupName="rowCount" AutoPostBack="true" />
</aspanel>
<div>
<FarPoint:FpSpread ID="spHeader" runat="server" BorderColor="#A0A0A0" BorderStyle="Solid" BorderWidth="1px" Height="300" Width="400">
<CommandBar BackColor="#F6F6F6" ButtonFaceColor="Control" ButtonHighlightColor="ControlLightLight" ButtonShadowColor="ControlDark" Visible="false"></CommandBar>
<Sheets>
<FarPoint:SheetView SheetName="Sheet1"></FarPoint:SheetView>
</Sheets>
</FarPoint:FpSpread>
</div>
<br />
</form>
</body>
</html>
后台代码
TestDemo.aspx.vb
Public Class TestDemo
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
DataBing(20)
End If
End Sub
Private Sub DataBing(ByRef rowCount As Integer)
spHeader.ActiveSheetView.RowCount = 0
'spDetail.ActiveSheetView.RowCount = 0
Dim ck As New FarPoint.Web.Spread.CheckBoxCellType
ck.AutoPostBack = False
ck.OnClientClick = "spHeader_MoveClick();"
spHeader.ActiveSheetView.AllowPage = False
spHeader.ActiveSheetView.RowCount = rowCount
spHeader.ActiveSheetView.ColumnCount = 6
For row As Integer = 0 To spHeader.ActiveSheetView.RowCount - 1
spHeader.ActiveSheetView.Cells(row, 0).CellType = ck
Next
End Sub
Protected Sub rdo50_CheckedChanged(sender As Object, e As EventArgs)
DataBing(20)
End Sub
Protected Sub rdo500_CheckedChanged(sender As Object, e As EventArgs)
DataBing(500)
End Sub
End Class
画面现象
|