表格控件 Spread for ASP.NET 7 新特性-按需加載

性能是 Web 應用程序的一塊短板,加載幾千條數據甚至幾萬條數據時每每須要等待較長時間,這無疑大大下降了用戶體驗。使用表格控件 Spread for ASP.NET 7按需加載功能,能夠在加載部分數據的狀況下展現數據,同時在後臺異步加載其餘數據,從而達到良好的用戶體驗。 服務器

表格控件 Spread for ASP.NET 7 容許用戶按需加載數據-當用戶向下拖拽 Spread 滾動條時,Spread 會自動從服務器端加載一頁數據到客戶端。 異步

 

能夠設置初始加載行數和每次按需加載的行數。您能夠在 Spread 級別和表單級別定製這兩個屬性。 post

FpSpread 類: 性能

  • FpSpread.AllowLoadOnDemand
  • FpSpread.LoadInitRowCount
  • FpSpread.LoadRowIncrement

SheetView 類: spa

  • SheetView.AllowLoadOnDemand
  • SheetView.LoadInitRowCount
  • SheetView.LoadRowIncrement

Spread 擁有兩種按需加載模式: code

OffsetBased 觸發模式,從截圖中咱們能夠看到滾動條滾動到底部時,表格控件 Spread 會自動從後臺異步加載數據: orm

 

Demo8

定時觸發模式,從截圖中能夠看到 表格控件 Spread 能夠按時加載數據。 htm

Demo10

下面咱們就介紹以上兩種按需加載方式的實現方法。 blog

OffsetBased 觸發模式代碼以下: ci

?
1
2
3
4
5
6
7
8
9
10
11
12
1:        //設置應用按需加載特性
 2:       sheet.AllowLoadOnDemand =true;
 3:       sheet.PageSize = 200;
 4:        //設置首次加載行數
 5:       sheet.LoadInitRowCount = 20;
 6:        //設置每次加載行數
 7:       sheet.LoadRowIncrement = 10;
 8:        //設置加載方式爲後天加載
 9:       sheet.LoadOnDemandMode = FarPoint.Web.Spread.LoadOnDemandMode.Background;
 10:      //設置加載模式爲 OffsetBased
 11:       sheet.LoadOnDemandTriggerMode = FarPoint.Web.Spread.LoadOnDemandTriggerMode.OffsetBased;
 12:       sheet.LoadOffsetFromBottom = 5;

定時觸發模式:

?
1
2
3
4
5
6
7
8
9
10
11
12
1: sheet.AllowLoadOnDemand =true;
 2:       sheet.PageSize = 100;
 3:      //設置首次加載行數
 4:       sheet.LoadInitRowCount = 10;
 5:      //設置每次加載行數
 6:       sheet.LoadRowIncrement = 5;
 7:      //設置加載方式爲後臺加載
 8:       sheet.LoadOnDemandMode = FarPoint.Web.Spread.LoadOnDemandMode.Background;
 9:      //設置加載模式爲定時加載
 10:       sheet.LoadOnDemandTriggerMode = FarPoint.Web.Spread.LoadOnDemandTriggerMode.Timed;
 11:      //設置定時加載時間間隔
 12:       sheet.LoadOnDemandInterval = 1000;
 

好了,以上即爲 Spread 按需加載特性介紹。

更多新特性請參考在線演示實例:

http://www.gcpowertools.com.cn/LiveSamples/Spread/ASPNET/sampleexplorer/samples/LoadOnDemand/Overview.aspx

同時,您也能夠下載源碼:

http://www.gcpowertools.com.cn/products/Spread_Studio_demo.htm

相關文章
相關標籤/搜索