Views

A table can have several views. Tasks may be entered in a grid and their status tracked on a kanban; switching between the two does not copy any records.

One table, multiple views

Change the Sheets course status, then switch views. Every view uses the same records.

Example learning schedule · September 2026

CourseStatusDate
SheetsPlanned
DocsIn progress
SlidesDone
BasesIn progress

Shared records: 4 · Sheets: Planned

ViewUse caseMain configuration
GridEditing, filtering, and sorting rowsFrozen fields, row height, field widths
KanbanGrouping by status or ownergroupFieldId
CalendarScheduling records by datestartDateFieldId, optional end date
GanttPlanning duration and dependenciesStart and end dates, plan comparison, completion, predecessors, and work calendar
GalleryShowing images and content cardsCover, title, and card fields
PivotSummaries and chartsRequires the dashboard plugin

The examples assume that a table already exists. Replace the field IDs with real fields, and create any date or grouping fields before configuring the view that uses them.

Create views

TypeScript
const grid = table.createView('All records', univerAPI.Enum.BaseViewType.Grid)const kanban = table.createView(  'By status',  univerAPI.Enum.BaseViewType.Kanban,  {    view: {      config: { groupFieldId: 'status' },    },  },)

Activate a view in the UI

TypeScript
const baseUI = univerAPI.getBaseUI()await baseUI.activateTable(table.getId())await baseUI.activateView(kanban.getId())

Configure view rules

TypeScript
kanban.setGroup([  { fieldId: 'status', direction: univerAPI.Enum.BaseSortDirection.ASC },])kanban.setFilter({  conjunction: univerAPI.Enum.BaseFilterConjunction.AND,  conditions: [    { fieldId: 'archived', operator: univerAPI.Enum.BaseFilterOperator.IS, operand: false },  ],})

Field settings on a view control visibility, widths, and card display. They do not change the underlying table schema.

Calendar dates

TypeScript
const calendar = table.createView('Schedule', univerAPI.Enum.BaseViewType.Calendar, {  view: {    config: { startDateFieldId: 'startDate', endDateFieldId: 'endDate', mode: 'month' },  },})

A calendar requires a start-date field. Gantt also requires an end-date field, and supports working days, progress, and dependencies. In a gallery, card configures the title and the fields that each card displays.

Gantt planning

startDateFieldId and endDateFieldId are required. progressFieldId binds a Progress field; its value sets each bar's completion, and completion can be dragged on desktop. workingDaysOnly shades non-working days in the timeline and counts each bar in working days. workingDays defines the weekly pattern and exceptions used for those counts and variance.

KeyTypeDescription
startDateFieldIdstringStart-date field for the current schedule.
endDateFieldIdstringEnd-date field for the current schedule.
progressFieldIdstringProgress field that supplies completion.
showPlanComparisonbooleanShows planned bars below the current bars.
planStartDateFieldIdstringDate field with the planned start.
planEndDateFieldIdstringDate field with the planned finish.
planColorstringFill color of the planned bars.
remainingColorstringColor of incomplete work when progressFieldId is set. A lighter shade of the bar color is used by default.
workingDaysOnlybooleanMarks non-working days and counts working days only.
workingDaysobjectWorking-day calendar with weekdays and exceptions.
TypeScript
const gantt = table.createView('Delivery', univerAPI.Enum.BaseViewType.Gantt, {  view: {    config: {      startDateFieldId: 'startDate',      endDateFieldId: 'endDate',      progressFieldId: 'progress',      showPlanComparison: true,      planStartDateFieldId: 'plannedStart',      planEndDateFieldId: 'plannedEnd',    },  },})

In the UI, open Gantt View Settings and enable "Compare with plan", then select the planned start and finish fields. Planned bars render under the current bars when both planned fields are set. Hover over a bar on desktop or tap it on mobile to compare both schedules. The tooltip reports start and finish variance in workdays.

Gantt predecessors

Set dependencyFieldId to a multi-value Record Link field that targets the same table. The field must be editable and must not be a system field.

The @univerjs-pro/bases package exports AddGanttPredecessorCommand and RemoveGanttPredecessorCommand. Both accept unitId, tableId, viewId, predecessorId, and successorId. The add command returns true when the link exists after the call, false when the request is rejected, and 'cycle' when the link would create a cyclic dependency. The remove command returns true when the link is absent after the call.

TypeScript
import { AddGanttPredecessorCommand, RemoveGanttPredecessorCommand } from '@univerjs-pro/bases'const base = univerAPI.getActiveBase()if (!base) throw new Error('No active Base')const params = {  unitId: base.getId(),  tableId: table.getId(),  viewId: gantt.getId(),  predecessorId: 'task-1',  successorId: 'task-2',}const added = await univerAPI.executeCommand(AddGanttPredecessorCommand.id, params)// true: linked, false: rejected, 'cycle': would create a cycleawait univerAPI.executeCommand(RemoveGanttPredecessorCommand.id, params)

On desktop, drag the connector at either end of a current bar onto another bar to add a finish-to-start link. One undo removes the link.

For collaborative Gantt editing, upgrade the gateway to a version that supports Base operational transforms before deploying 1.6.0 clients.

Sorting and field display

TypeScript
grid.setSort([{ fieldId: 'priority', direction: univerAPI.Enum.BaseSortDirection.DESC }])grid.setFieldVisible('internalNotes', false)grid.setFieldWidth('title', 280)

Filters, sorting, grouping, and field display all belong to the current view. None of these settings deletes the underlying records or fields.

Conditional coloring

The following rule highlights records whose score is above 80:

TypeScript
const score = table.addField('Score', univerAPI.Enum.BaseFieldType.Number)grid.setConditionalColorRules([{  id: 'high-score',  target: univerAPI.Enum.BaseConditionalColorTarget.ROW,  fieldId: score.getId(),  operator: univerAPI.Enum.BaseConditionalColorOperator.GREATER_THAN,  operand: 80,  color: '#dcfce7',}])

Rules take priority in array order. Pass [] to clear all rules. The target may be a cell, a row, or a column; coloring a column is unconditional.

How is this guide?

© 2026 DreamNum Co., Ltd.