Add show_rows parameter to create_dt() function for customizable default row display#246
Merged
Conversation
Co-authored-by: martinctc <17925865+martinctc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Feature request:
Add show_rows parameter to create_dt() function for customizable default row display
Aug 4, 2025
create_dt() parameter to show default number of rows to show
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds a new
show_rowsparameter to thecreate_dt()function to allow users to customize the default number of rows displayed in DataTable outputs, addressing a common user request for more flexible table display options.The
roundingargument also now accepts a named list, allowing more flexibility in specifying which rounding formats to use for which columns. This was achieved with backward compatibility.Changes Made
New Parameter:
show_rowsparameter with default value10to maintain backward compatibility"All"to specify the default number of rows to displayDynamic Length Menu Construction:
lengthMenuwith dynamic construction based onshow_rowsvalueshow_rows = 25: Creates menu[25, 10, 50, -1]with labels[25, 10, 50, "All"]show_rows = "All": Creates menu[-1, 25, 10, 50]with labels["All", 25, 10, 50]Examples:
Backward Compatibility
All existing code continues to work without modification since
show_rowsdefaults to10, preserving the original behavior. The change affects 11 files across the codebase that usecreate_dt(), all of which remain fully compatible.Testing
Added comprehensive test suite in
test-create_dt.Rto verify:show_rowsvalues"All"and-1parameter valuesFixes #245.