DataGrid in a MainView

Hi,

In 2.2 version is it possible to add a dataGrid of an entity to the mainView?

I would like to be able to display that dataGrid in the mainView to show information.

Thanks.

Yes, it’s possible. You just need to add your components inside <initialLayout> within your MainView XML descriptor. For example:

        .
        .
        .
        </drawerLayout>
        <initialLayout>
            <dataGrid id="usersDataGrid" width="100%" columnReorderingAllowed="true"
                      minHeight="20em" dataContainer="usersDc">
                <columns resizable="true">
                    <column property="username"/>
                    <column property="firstName"/>
                    <column property="lastName"/>
                    <column property="email"/>
                    <column property="timeZoneId"/>
                    <column property="active"/>
                </columns>
            </dataGrid>
        </initialLayout>
    </appLayout>
</mainView>

Hi,

When entering the <initialLayout> it does not recognize it.

image

My jmix version:

image

Hi Daniel

You need to modify your MainView XML descriptor. Means in the main-view.xml you find this <initialLayout> where you have to insert your grid.

Regards

Felix

That’s the plugin version, maybe you have to update the project’s Jmix version in ‘Project Properties’:
image

1 Like