cardView.pageLength
Determine how CardView will handle the table's page length.
Please note - this property requires the CardView extension for DataTables.
Description
When switching between the card and table view of a DataTable with CardView, the page length of a table might not always suit the layout for a grid of cards. For example, a default page length of 10, does not round nicely with a grid layout of 3 cards per row - 9 would be preferred.
For this reason CardView provides two options for page length control:
fit- CardView will adjust the DataTable's page length when the card view is activated to the nearest round number for the number of cards that will fit per row in the current display.core- CardView will make no adjustments to the page length, leaving it as specified by DataTables core.
When fit is used, CardView will determine the number of columns that will be displayed based on the current content width and the responsive configuration of CardView (cardView.breakpoints and cardView.gridColumns), then use nearest whole number to the current paging length to fit that number of columns (e.g. for a path length of 10, showing 3 cards per row, the page length will be changed to 9).
Furthermore, CardView will update any pageLength selector for the DataTable with appropriate nearest values, and also undo those changes when switching back to table view. As the number of columns changes (content width changes due to page resize for example), the page lengths will be updated appropriately.
Type
string
Page fitting configuration to use - can be one of fit or core.
Default
- Value:
fit
The table's page length will be adjusted to a multiplier of the number of cards that can be placed in a single row.
Example
Do not change the DataTable length when changing view modes:
new DataTable('#myTable', {
cardView: {
pageLength: 'core'
}
});