Example for Tabs and Fragments

Are there any examples for to use fragments and tabs together? When I try to combine both features I only get a blank tab without any error messages. The fragment itself is very simple and contains only a span (also tried div) showing “Hello World”

I already tried this:

        <tabSheet id="tabSheet" width="100%">
            <tab id="issueTab" label="Issues">
                <fragment class="com.company.Myfragment"/>
            </tab>
        </tabSheet>

And also this:

@Autowired
    protected Fragments fragments;

    protected void initTabSheet() {
        tabSheet.add(createConfigTab(), new LazyComponent(this::createConfigTabContent));

    }

    private Component createConfigTabContent() {
        return fragments.create(this, MyFragment.class);

Hi,

Could you please attach a small demo project that reproduces the issue?

Regards,
Gleb

I just got it working. The issue was not in the fragment. I used a simple <span >Hello</span> for testing, but it should be <span text="Hello"/> So everything works as expected.

1 Like