仮想ページング
従来のページャーボタンによるページ移動に加えて、垂直スクロールバーの移動によるページ移動が可能です。
SPREADは1ページ分のデータしか保持しないので、あたかも全データが表示されているかのようなユーザーインタフェースでパフォーマンスが最適化されます。
| A | B | C | D |
1 | 1 | | | |
2 | 2 | | | |
3 | 3 | | | |
4 | 4 | | | |
5 | 5 | | | |
6 | 6 | | | |
7 | 7 | | | |
8 | 8 | | | |
9 | 9 | | | |
10 | 10 | | | |
|
|
ソースコード
別ウィンドウで表示
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class paging_virtualpaging : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
return;
}
// SPREAD初期化
InitSpread(FpSpread1, FpSpread1.Sheets[0]);
}
private void InitSpread(FarPoint.Web.Spread.FpSpread spread, FarPoint.Web.Spread.SheetView sheet)
{
int i = 0;
// SPREAD設定
spread.UseClipboard = false;
spread.CssClass = "spreadStyle";
spread.Pager.Mode = FarPoint.Web.Spread.PagerMode.Both;
spread.Pager.Position = FarPoint.Web.Spread.PagerPosition.TopCommandBar;
// フォントサイズの設定
sheet.DefaultStyle.Font.Size = FontUnit.Parse("80%");
sheet.ColumnHeader.DefaultStyle.Font.Size = FontUnit.Parse("80%");
sheet.RowHeader.DefaultStyle.Font.Size = FontUnit.Parse("80%");
sheet.SheetCorner.DefaultStyle.Font.Size = FontUnit.Parse("80%");
FarPoint.Web.Spread.Model.DefaultSheetDataModel datamodel = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)sheet.DataModel;
datamodel.RowCount = 2000;
for (i = 0; i <= datamodel.RowCount - 1; i++)
{
datamodel.SetValue(i, 0, i + 1);
}
sheet.AllowVirtualScrollPaging = true;
}
}
|
Partial Class paging_virtualpaging
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
' SPREAD初期化
InitSpread(FpSpread1, FpSpread1.Sheets(0))
End Sub
Private Sub InitSpread(ByVal spread As FarPoint.Web.Spread.FpSpread, ByVal sheet As FarPoint.Web.Spread.SheetView)
Dim i As Integer = 0
' SPREAD設定
spread.UseClipboard = False
spread.CssClass = "spreadStyle"
spread.Pager.Mode = FarPoint.Web.Spread.PagerMode.Both
spread.Pager.Position = FarPoint.Web.Spread.PagerPosition.TopCommandBar
' フォントサイズの設定
sheet.DefaultStyle.Font.Size = FontUnit.Parse("80%")
sheet.ColumnHeader.DefaultStyle.Font.Size = FontUnit.Parse("80%")
sheet.RowHeader.DefaultStyle.Font.Size = FontUnit.Parse("80%")
sheet.SheetCorner.DefaultStyle.Font.Size = FontUnit.Parse("80%")
Dim datamodel As FarPoint.Web.Spread.Model.DefaultSheetDataModel = DirectCast(sheet.DataModel, FarPoint.Web.Spread.Model.DefaultSheetDataModel)
datamodel.RowCount = 2000
For i = 0 To datamodel.RowCount - 1
datamodel.SetValue(i, 0, i + 1)
Next
sheet.AllowVirtualScrollPaging = True
End Sub
End Class
|
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="virtualpaging.aspx.cs" Inherits="paging_virtualpaging" %>
<%@ Register Assembly="FarPoint.Web.SpreadJ" Namespace="FarPoint.Web.Spread" TagPrefix="FarPoint" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeaderPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="#A0A0A0" BorderStyle="Solid"
BorderWidth="1px">
<CommandBar BackColor="#F6F6F6" ButtonFaceColor="Control" ButtonHighlightColor="ControlLightLight"
ButtonShadowColor="ControlDark">
</CommandBar>
<Sheets>
<FarPoint:SheetView SheetName="Sheet1">
</FarPoint:SheetView>
</Sheets>
</FarPoint:FpSpread>
</asp:Content>
|