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

Ability to Show/Hide tabs in form dinamically #9

Merged
merged 13 commits into from
Jul 12, 2019

Conversation

boing6000
Copy link
Contributor

Hi, thanks,

I have added to CoreForm.vue this 2 methods:

   hideTab(tab){
        return this.ready
            ? this.sections(tab).forEach(section => section.fields.forEach(field => field.meta.hidden = true))
            : null;
    },
    showTab(tab){
        return this.ready
            ? this.sections(tab).forEach(section => section.fields.forEach(field => field.meta.hidden = false))
            : null;
    }

watch:{
'state.data.sections': {
handler: function(val){
this.$forceUpdate();
},
deep: true
}
},

With this i could show/hide tabs dynamically in a switch like below:

showTab1(event) {
return event
? this.$refs.form.showTab('tab1')
: this.$refs.form.hideTab('tab2');
}

call to show/hide tabs
expose hide/show tabs
Ability to show/hide tabs dinamically
this.$forceUpdate(); will not be more necessary in watch since itl will be called in showTab/hideTab to force the render of tabs dinamically
Added ability to $emit undo envent to be possible to call custom methods like Show/Hide tabs
@aocneanu aocneanu added this to In Review in Enso Ui Jul 12, 2019
aocneanu added a commit to laravel-enso/forms that referenced this pull request Jul 12, 2019
@aocneanu aocneanu merged commit 7ea0f98 into enso-ui:master Jul 12, 2019
Enso Ui automation moved this from In Review to Done Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Enso Ui
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants