Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support showing all rows as a length option in DataTables #868

Merged

Conversation

alistair3149
Copy link
Contributor

By adding -1 to datatables-lengthMenu, all rows can be shown.

image

By adding -1 to datatables-lengthMenu, all rows can be shown
// Replace -1 in lengthMenu with 'all' label
var showAll = options.lengthMenu.indexOf( -1 );
if ( showAll !== -1 ) {
var labels = options.lengthMenu.slice();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the slice()?

Copy link
Contributor Author

@alistair3149 alistair3149 Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to clone the array so that the original options.lengthMenu wouldn't be altered.

I'm not sure what is the stance on ES6 in the project so I didn't use spread operators.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so that the original options.lengthMenu wouldn't be altered.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Line 566, we set two arrays to the lengthMenu. The first array is for the numerical values (-1 represents all, which is the original values), the second array is for the label (all represents -1).

@JeroenDeDauw JeroenDeDauw merged commit a63b58c into SemanticMediaWiki:master Nov 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants