Added ability to slice data-grid results for pagination; fix data-grid docs #946
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was no way to create pagination for datagrid results with the current API. This was a huge feature request as grid items are based on html and with large datasets dc.js would be rendering a huge number of DOM nodes that were not relevant to the user. Using .top() to filter was not enough as most users expect to be able to see the next available page.
Because of this limitation I added the ability to specify a slicing range. I am slicing the entries array to achieve this. With the beginSlice and endSlice attributes it is fairly simple to implement pagination using datagrids. Updating these parameters and then redrawing the graph also for very simple and efficient pagination, eliminating the need to draw possible hundreds of thousands of DOM nodes.
I also added a comment that notes the difference between how dataGrid uses .group() versus the other charts. DataGrid actually wants a keying function, not a crossfilter function. This was very confusing to myself and other developers, so I explicitly call out this discrepancy in the documentation.