Skip to content

@Vis Multi-View

@Vis lets you attach multiple views to a single Erupt entity and display them as tabs side by side. Use visRawTable to control whether the default table view is kept, and the vis array to add extra views.

Supported in 1.13.2+

Basic Usage

java
@Erupt(
    name = "Task Management",
    visRawTable = true,
    vis = {
        @Vis(title = "Cards", type = Vis.Type.CARD, cardView = @CardView),
        @Vis(title = "Gantt", type = Vis.Type.GANTT,
             ganttView = @GanttView(startDateField = "startDate", endDateField = "endDate"))
    }
)
@Entity
public class Task extends BaseModel { ... }

@Vis Attributes

AttributeDescription
codeUnique view identifier, optional
titleTab label (required)
descView description
typeView type, defaults to TABLE, see enum below
fieldVisibilityField visibility mode: INCLUDE (show only) / EXCLUDE (hide), defaults to EXCLUDE
fieldsList of field names used with fieldVisibility
filterIndependent data filter for this view (@Filter)
orderByIndependent sort rule for this view (@Sort)
showDynamically controls whether the tab is visible (ExprBool)
cardViewCard view configuration, active when type = CARD, see Card View
ganttViewGantt chart configuration, active when type = GANTT, see Gantt Chart
tplViewCustom template configuration, active when type = TPL

Type Enum

ValueDescription
TABLETable view (can be combined with field filtering)
CARDCard / grid view
GANTTGantt chart
TPLCustom template view

visRawTable

Setting visRawTable = false hides the default table and shows only the views defined in vis:

java
@Erupt(
    name = "Task Board",
    visRawTable = false,
    vis = {
        @Vis(title = "Cards", type = Vis.Type.CARD, cardView = @CardView)
    }
)

TABLE View: Field Filtering

When type = TABLE (the default), use fieldVisibility + fields to filter columns without defining a separate entity class:

java
@Erupt(
    name = "Employee Management",
    vis = {
        @Vis(
            code = "summary", title = "Summary View",
            fieldVisibility = Vis.FieldVisibility.INCLUDE,
            fields = {"name", "status"}          // show only these two columns
        ),
        @Vis(
            code = "internal", title = "Internal View",
            fieldVisibility = Vis.FieldVisibility.EXCLUDE,
            fields = {"salary"}                  // hide the salary column
        )
    }
)

Contributors

The avatar of contributor named as YuePeng YuePeng

Changelog

Released under the Apache-2.0 License.