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

Allow table widget to have a minimum and maximum of items #740

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

bennothommo
Copy link
Member

This PR adds the config variables minItems and maxItems for the Table widget and datatable field type. The impetus of this is to allow a table to have no items by setting the minItems to 0 - I have found in my travels that if you have any sort of validation on the table widget, then you must have at least one record, but in my case, I wanted the datatable field to be optional.

I then thought it might be useful to have the opposite, and allow an upper limit for the number of records.

Some rules on the above:

  • minItems must be 0 or above. By default, it is 1 to match the current functionality. If minItems is 2, then 2 records must be in the datatable at all times (the datatable will have 2 empty records added on load).
  • maxItems must be either 1 or above, or null to indicate no limit.
  • minItems must be less than or equal to maxItems, to allow a datatable to have a fixed number of records.

To allow this change to happen, I've decided to change the datasource objects (client and server-side data handling) to use promises - this way, we have a common way of reading the responses, and it will gracefully handle the server-side taking a little longer to make changes to the data.

As part of this commit, I've changed the datasources to use promises, to provide a unified response between client and server-side datasources.
@bennothommo bennothommo added enhancement PRs that implement a new feature or substantial change Status: In Progress labels Oct 25, 2022
@bennothommo bennothommo added this to the v1.2.2 milestone Oct 25, 2022
@bennothommo bennothommo added needs review Issues/PRs that require a review from a maintainer and removed Status: In Progress labels Oct 26, 2022
@bennothommo bennothommo marked this pull request as ready for review October 26, 2022 05:51
@LukeTowers LukeTowers modified the milestones: v1.2.2, v1.2.3 Apr 20, 2023
@LukeTowers LukeTowers modified the milestones: v1.2.3, v1.2.4 Jul 7, 2023
@LukeTowers LukeTowers modified the milestones: v1.2.4, 1.2.5 Dec 27, 2023
@LukeTowers
Copy link
Member

@bennothommo what's the status of this?

@bennothommo
Copy link
Member Author

I'm gonna say I think it is complete... Definitely haven't tested it quite some time though.

@LukeTowers
Copy link
Member

@bennothommo do we have a docs PR for it?

@bennothommo
Copy link
Member Author

I will test it first, and then I'll put up a docs PR, in case anything needs to change.

@LukeTowers LukeTowers modified the milestones: 1.2.5, 1.2.6 Feb 26, 2024
@LukeTowers LukeTowers removed this from the 1.2.6 milestone Apr 25, 2024
@LukeTowers
Copy link
Member

@bennothommo what's the status on this?

@bennothommo
Copy link
Member Author

Same as before. Still needs docs and testing. Haven't had a need for it yet - I think I did this for my old job.

@LukeTowers
Copy link
Member

@der-On or @WebVPF, either of you bored and looking for something to do 😉?

@der-On
Copy link
Contributor

der-On commented Apr 26, 2024

@LukeTowers Bored to the bones 😹 . Sorry I'm currently out on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs that implement a new feature or substantial change needs review Issues/PRs that require a review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants