Serenity: Dialogs tab switching by code

Created on 27 Aug 2018  路  2Comments  路  Source: serenity-is/Serenity

Is there way to switch tabs on Dialog/Form ?

I searched forum, but my this.tabs is undefined so

this.tabs.tabs('option', 'active', 2);

did not work

neither did this:

Serenity.TabsExtensions.selectTab(this.tabs, "Licences");

I have feeling these work for tabs defined in html template, not tabs generated from Forms declarations.any idea how to switch between those of Form?

Most helpful comment

    export function selectEditorTab(editor: Serenity.Widget<any>) {
        let tabId = editor.element.closest('.tab-pane').attr('id');

        let tabAnchor = editor.element.closest('.s-PropertyGrid').find(`a[href='#${tabId}']`);

        (tabAnchor as any).tab('show');
    }

usage
selectEditorTab(this.form.aEditorInThatTab);

All 2 comments

    export function selectEditorTab(editor: Serenity.Widget<any>) {
        let tabId = editor.element.closest('.tab-pane').attr('id');

        let tabAnchor = editor.element.closest('.s-PropertyGrid').find(`a[href='#${tabId}']`);

        (tabAnchor as any).tab('show');
    }

usage
selectEditorTab(this.form.aEditorInThatTab);

worked, thx

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Shraddha996 picture Shraddha996  路  3Comments

AmuthaKondusamy picture AmuthaKondusamy  路  3Comments

Akarsh03 picture Akarsh03  路  3Comments

stixoffire picture stixoffire  路  3Comments

newyearsoft picture newyearsoft  路  3Comments