1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-grid.feature.Chunking'>/**
2 </span> * @class Ext.grid.feature.Chunking
3 * @extends Ext.grid.feature.Feature
5 Ext.define('Ext.grid.feature.Chunking', {
6 extend: 'Ext.grid.feature.Feature',
7 alias: 'feature.chunking',
10 rowHeight: Ext.isIE ? 27 : 26,
12 hasFeatureEvent: false,
13 attachEvents: function() {
14 var grid = this.view.up('gridpanel'),
15 scroller = grid.down('gridscroller[dock=right]');
16 scroller.el.on('scroll', this.onBodyScroll, this, {buffer: 300});
17 //this.view.on('bodyscroll', this.onBodyScroll, this, {buffer: 300});
20 onBodyScroll: function(e, t) {
23 nextChunk = Math.floor(top / this.rowHeight / this.chunkSize);
24 if (nextChunk !== this.visibleChunk) {
26 this.visibleChunk = nextChunk;
28 view.el.dom.scrollTop = top;
29 //BrowserBug: IE6,7,8 quirks mode takes setting scrollTop 2x.
30 view.el.dom.scrollTop = top;
34 collectData: function(records, preppedRecords, startIndex, fullWidth, orig) {
36 fullWidth: orig.fullWidth,
39 //headerCt = this.view.headerCt,
40 //colums = headerCt.getColumnsForTpl(),
41 recordCount = orig.rows.length,
44 visibleChunk = this.visibleChunk,
49 for (; start < recordCount; start+=this.chunkSize, i++) {
50 if (start+this.chunkSize > recordCount) {
51 chunkLength = recordCount - start;
53 chunkLength = this.chunkSize;
56 if (i >= visibleChunk - 1 && i <= visibleChunk + 1) {
57 rows = orig.rows.slice(start, start+this.chunkSize);
64 chunkHeight: chunkLength * this.rowHeight
72 getTableFragments: function() {
74 openTableWrap: function() {
75 return '<tpl for="chunks"><div class="' + Ext.baseCSSPrefix + 'grid-chunk" style="height: {chunkHeight}px;">';
77 closeTableWrap: function() {
78 return '</div></tpl>';
83 </pre></pre></body></html>