-
Notifications
You must be signed in to change notification settings - Fork 139
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
Question on showIf #221
Comments
The showIf and showUnless features were already in there when I took over. They're fully backend based, never really understood why anyone would use it like that either. I'm open to ideas on how to make your wish possible, personally I think it would be hard to figure out how to keep it simple, as the idea is that tabs can be used in both detail and form views. |
Hi! I will show you simple case: In the resource Runner I have tab: Workouts with workouts belongsTo runner. Runner can be active or inactive. If I'm creating workout for runner, on the list I can see only active runners. If I go to inactive detail page runner I can still see tab Workout, but there is no need to create workout. So, if there is any condition/s we don't want to some tab, we can hide/show it. I think it's really usefull. |
But from the example you gave, those are server side conditions? |
The same as for Nova fields. |
This is not an issue - just a question around usage of the showIf() method on the Tabs class.
The typical use case for me would be that the truthy/falsy value would depend on "other" fields on the form, and not data that is available on the "back end" yet.
Typically other components or Nova features (like dependsOn) would take a statement that is evaluated against these fields. so you could pass a statement that should evaluate to true or false using the fieldnames on the same resource.
Some pseudo code to illustrate:
The expected behavior is that as the user completes the form, certain tabs are hidden or shown, before any data is sent back to the backend in update or create call...
I'm pretty sure I am missing something, because the fact that there is a showIf and showUnless function suggests that the above should be possible, otherwise I would simply use back-end logic to add / not add the Tab to the Tabs object?
So could you please clarify with an example of a closure or statement in the correct syntax in order to use the "front end" field values?
PS: This example obviously only pertains to TabsOnEdit - on athe detail view I have the latest persisted values of the underlying model and can use the showIf using those attribues. But during edit, I would expect to have access to the fields on the form
Hope it makes sense...
PS: Awesome component BTW!!!
The text was updated successfully, but these errors were encountered: