@@ -34,6 +34,8 @@ dc.dataTable = function (parent, chartGroup) {
34
34
return d ;
35
35
} ;
36
36
var _order = d3 . ascending ;
37
+ var _beginSlice = 0 ;
38
+ var _endSlice ;
37
39
var _showGroups = true ;
38
40
39
41
_chart . _doRender = function ( ) {
@@ -155,7 +157,7 @@ dc.dataTable = function (parent, chartGroup) {
155
157
. sortKeys ( _order )
156
158
. entries ( entries . sort ( function ( a , b ) {
157
159
return _order ( _sortBy ( a ) , _sortBy ( b ) ) ;
158
- } ) ) ;
160
+ } ) . slice ( _beginSlice , _endSlice ) ) ;
159
161
}
160
162
161
163
function renderRows ( groups ) {
@@ -202,6 +204,34 @@ dc.dataTable = function (parent, chartGroup) {
202
204
return _chart ;
203
205
} ;
204
206
207
+ /**
208
+ #### .beginSlice([index])
209
+ Get or set the index of the beginning slice which determines which entries get displayed by the widget
210
+ Useful when implementing pagination.
211
+
212
+ **/
213
+ _chart . beginSlice = function ( _ ) {
214
+ if ( ! arguments . length ) {
215
+ return _beginSlice ;
216
+ }
217
+ _beginSlice = _ ;
218
+ return _chart ;
219
+ } ;
220
+
221
+ /**
222
+ #### .endSlice([index])
223
+ Get or set the index of the end slice which determines which entries get displayed by the widget
224
+ Useful when implementing pagination.
225
+
226
+ **/
227
+ _chart . endSlice = function ( _ ) {
228
+ if ( ! arguments . length ) {
229
+ return _endSlice ;
230
+ }
231
+ _endSlice = _ ;
232
+ return _chart ;
233
+ } ;
234
+
205
235
/**
206
236
* Get or set column functions. The data table widget now supports several methods of specifying
207
237
* the columns to display. The original method, first shown below, uses an array of functions to
0 commit comments