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
| Course | Status | Date |
|---|---|---|
| Sheets | Planned | |
| Docs | In progress | |
| Slides | Done | |
| Bases | In progress |
Shared records: 4 · Sheets: Planned
| View | Use case | Main configuration |
|---|---|---|
Grid | Editing, filtering, and sorting rows | Frozen fields, row height, field widths |
Kanban | Grouping by status or owner | groupFieldId |
Calendar | Scheduling records by date | startDateFieldId, optional end date |
Gantt | Planning duration and dependencies | Start and end dates, plan comparison, completion, predecessors, and work calendar |
Gallery | Showing images and content cards | Cover, title, and card fields |
Pivot | Summaries and charts | Requires 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
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
const baseUI = univerAPI.getBaseUI()await baseUI.activateTable(table.getId())await baseUI.activateView(kanban.getId())Configure view rules
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
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.
| Key | Type | Description |
|---|---|---|
startDateFieldId | string | Start-date field for the current schedule. |
endDateFieldId | string | End-date field for the current schedule. |
progressFieldId | string | Progress field that supplies completion. |
showPlanComparison | boolean | Shows planned bars below the current bars. |
planStartDateFieldId | string | Date field with the planned start. |
planEndDateFieldId | string | Date field with the planned finish. |
planColor | string | Fill color of the planned bars. |
remainingColor | string | Color of incomplete work when progressFieldId is set. A lighter shade of the bar color is used by default. |
workingDaysOnly | boolean | Marks non-working days and counts working days only. |
workingDays | object | Working-day calendar with weekdays and exceptions. |
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.
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
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:
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?