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 for default attribute #964

Merged
merged 1 commit into from
Jan 20, 2019
Merged

Conversation

pauloamgomes
Copy link
Contributor

@pauloamgomes pauloamgomes commented Jan 8, 2019

Support for default on fields select, text, textarea and rating - Issue #965

@pauloamgomes
Copy link
Contributor Author

Closing as per issue comment

@pauloamgomes
Copy link
Contributor Author

Reopen as changes on setting defaults seems to work with custom components.

@pauloamgomes pauloamgomes reopened this Jan 10, 2019
@pauloamgomes
Copy link
Contributor Author

@aheinze , when you can, kindly confirm if that make sense, I'm working in an implementation that uses custom components and having defaults (checkboxes, dropdowns, etc..) is mandatory. Tbh not sure why defaults work on collections but not on custom components, but forcing the verification and update on each field seems to solve it.

@aheinze
Copy link
Member

aheinze commented Jan 10, 2019

I need some time to figure this out. A generic solution for ALL fields would be cool. maybe extend/improve the cp-field component 🤔

@pauloamgomes
Copy link
Contributor Author

pauloamgomes commented Jan 20, 2019

@aheinze , after all after checking in more detail think that can be solved on the field-layout:

right now you have (field-layout.tag line 384):

item.settings[field.name] = field.default || null;

but it should be instead

item.settings[field.name] = field.options.default || null;

Since any definition on custom components are passed as field.options, updated the PR to reflect that change, please let me know if that way it works

@aheinze aheinze merged commit d092fd0 into agentejo:next Jan 20, 2019
@aheinze
Copy link
Member

aheinze commented Jan 20, 2019

awesome find! thank you!

pherrymason pushed a commit to pherrymason/cockpit that referenced this pull request May 3, 2020
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.

None yet

2 participants