# FBaseTableView

> Language fallback: requested `zh-CN`; content is `en-US`.

- Human documentation: [https://docs.univer.ai/zh-CN/reference/facade/base-table-view](https://docs.univer.ai/zh-CN/reference/facade/base-table-view)

- Agent Markdown: [https://docs.univer.ai/zh-CN/reference/facade/base-table-view.md](https://docs.univer.ai/zh-CN/reference/facade/base-table-view.md)

- Requested language: `zh-CN`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/base-table-view.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/base-table-view.mdx)

---

Facade API object bound to a Base view.

A view stores table projection settings such as filter, sort, group, field visibility, and view-specific config.
The facade writes those settings through commands so projections, events, and
collaboration invalidations stay in sync.

## Access

Access through:

* [`FBaseTable.getViews()`](https://docs.univer.ai/zh-CN/reference/facade/base-table.md#getviews)
* [`FBaseTable.getViewById()`](https://docs.univer.ai/zh-CN/reference/facade/base-table.md#getviewbyid)
* [`FBaseTable.getViewByName()`](https://docs.univer.ai/zh-CN/reference/facade/base-table.md#getviewbyname)
* [`FBaseTable.createView()`](https://docs.univer.ai/zh-CN/reference/facade/base-table.md#createview)

## Example

Configure a grid projection

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')

const grid = fBaseTable.createView('Main Grid', univerAPI.Enum.BaseViewType.Grid)
grid.updateConfig({ frozenFieldCount: 1 })
grid.setFilter({
  conjunction: univerAPI.Enum.BaseFilterConjunction.AND,
  conditions: [
    {
      fieldId: 'status',
      operator: univerAPI.Enum.BaseFilterOperator.IS,
      operand: 'done',
    },
  ],
})
grid.setSort([
  {
    fieldId: 'progress',
    direction: univerAPI.Enum.BaseSortDirection.DESC,
  },
])
grid.setFieldVisible('internalNotes', false)

const projection = grid.getProjection()
console.log(projection)
```

## Setup

Register [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) or a preset that includes it. In plugin mode, import `@univerjs-pro/bases/facade`. Additional methods below require their listed plugin packages. See [Facade setup](https://docs.univer.ai/zh-CN/guides/bases/getting-started/facade.md).

## `@univerjs-pro/bases`

### `FBaseTableView.addConditionalColorRule`

Append one conditional coloring rule at the lowest priority.

Use `setConditionalColorRules` when inserting at a specific priority
or replacing an existing rule. Duplicate ids and invalid rule values throw
before the Base is mutated.

```typescript
addConditionalColorRule(rule: IBaseConditionalColorRule): boolean
```

**Parameters**

* `rule` — Required. Rule to append after all existing rules.

**Returns**

`true` when the update command succeeds; otherwise `false`.

**Examples**

Add a low-priority warning rule

```ts
const base = univerAPI.getActiveBase()
if (!base) throw new Error('Open a Base before running this example.')
const table = base.insertTable(`Conditional color add ${Date.now()}`, {
  primaryFieldName: 'Risk item',
})
const level = table.addField('Risk level', univerAPI.Enum.BaseFieldType.Number)
const view = table.getViewByName('Grid')
if (!view) throw new Error('The default Grid view was not created.')

const success = view.addConditionalColorRule({
  id: 'medium-risk',
  color: '#fff7df',
  target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
  fieldId: level.getId(),
  operator: univerAPI.Enum.BaseConditionalColorOperator.GREATER_THAN,
  operand: 50,
})
console.log({ success, rules: view.getConditionalColorRules() })
```

**Types:** [`IBaseConditionalColorRule`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.clearConditionalColorRules`

Clear every conditional coloring rule from this view.

```typescript
clearConditionalColorRules(): boolean
```

**Returns**

`true` when rules existed and the clear command succeeds; otherwise `false`.

**Examples**

Clear conditional coloring without changing filters, sorts, or other view config

```ts
const base = univerAPI.getActiveBase()
if (!base) throw new Error('Open a Base before running this example.')
const table = base.insertTable(`Conditional color clear ${Date.now()}`, {
  primaryFieldName: 'Task',
})
const title = table.getPrimaryField()
const view = table.getViewByName('Grid')
if (!view) throw new Error('The default Grid view was not created.')
view.addConditionalColorRule({
  id: 'temporary-rule',
  color: '#eef3ff',
  target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
  fieldId: title.getId(),
  operator: univerAPI.Enum.BaseConditionalColorOperator.IS_NOT_EMPTY,
})

const cleared = view.clearConditionalColorRules()
console.log({ cleared, rules: view.getConditionalColorRules() })
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.delete`

Delete this view.

```typescript
delete(): boolean
```

**Returns**

True if the view was deleted, false if the view was already deleted.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const success = view.delete()
console.log(success ? 'View deleted' : 'Delete view failed')
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.deleteConditionalColorRule`

Delete one conditional coloring rule by its stable id.

Deleting the last rule clears the persisted conditional coloring config.
A missing id is a no-op and returns `false`.

```typescript
deleteConditionalColorRule(ruleId: string): boolean
```

**Parameters**

* `ruleId` — Required. Id of the rule to delete.

**Returns**

`true` when the rule existed and the update command succeeds; otherwise `false`.

**Examples**

Delete a rule and verify the persisted result

```ts
const base = univerAPI.getActiveBase()
if (!base) throw new Error('Open a Base before running this example.')
const table = base.insertTable(`Conditional color delete ${Date.now()}`, {
  primaryFieldName: 'Task',
})
const title = table.getPrimaryField()
const view = table.getViewByName('Grid')
if (!view) throw new Error('The default Grid view was not created.')
view.addConditionalColorRule({
  id: 'medium-risk',
  color: '#fff7df',
  target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
  fieldId: title.getId(),
  operator: univerAPI.Enum.BaseConditionalColorOperator.CONTAINS,
  operand: 'delay',
})

const deleted = view.deleteConditionalColorRule('medium-risk')
console.log({ deleted, rules: view.getConditionalColorRules() })
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getConditionalColorRules`

Get this view's conditional coloring rules in priority order.

Rules at the beginning of the array have higher priority. The returned
array is a deep copy, so changing it does not mutate the Base. Call
`setConditionalColorRules` to persist edits or reorder rules.

```typescript
getConditionalColorRules(): IBaseConditionalColorRule[]
```

**Returns**

A copy of the persisted rules. Returns `[]` when no rules are configured.

**Examples**

Read rules created by either the UI or the Facade

```ts
const base = univerAPI.getActiveBase()
if (!base) throw new Error('Open a Base before running this example.')

const table = base.insertTable(`Conditional color read ${Date.now()}`, {
  primaryFieldName: 'Task',
})
const title = table.getPrimaryField()
const view = table.getViewByName('Grid')
if (!view) throw new Error('The default Grid view was not created.')
view.setConditionalColorRules([
  {
    id: 'blocked-task',
    color: '#fde9e9',
    target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
    fieldId: title.getId(),
    operator: univerAPI.Enum.BaseConditionalColorOperator.CONTAINS,
    operand: 'blocked',
  },
])

const rules = view.getConditionalColorRules()
console.log(rules.map((rule, priority) => ({ priority, ...rule })))
```

**Types:** [`IBaseConditionalColorRule`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getConfig`

Get the view-specific config.

```typescript
getConfig(): ViewSpecificConfig
```

**Returns**

The view-specific config.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const config = view.getConfig()
console.log(config)
```

**Types:** [`ViewSpecificConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getFieldSettings`

Get settings for a field in this view.

```typescript
getFieldSettings(fieldId: string): IViewFieldSetting
```

**Parameters**

* `fieldId` — Required. The field id.

**Returns**

The field settings, or an empty object if no settings are set.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const settings = view.getFieldSettings('status')
console.log(settings)
```

**Types:** [`IViewFieldSetting`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getFilter`

Get the view filter.

```typescript
getFilter(): IFilterConfig | null
```

**Returns**

The view filter, or `null` if no filter is set.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
console.log(view.getFilter())
```

**Types:** [`IFilterConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getGroup`

Get the view group rules.

```typescript
getGroup(): IGroupConfig[]
```

**Returns**

The group rules.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
console.log(view.getGroup())
```

**Types:** [`IGroupConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getId`

Get the view id.

```typescript
getId(): string
```

**Returns**

The view id.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const views = fBaseTable.getViews()
console.log(views[0]?.getId())
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getName`

Get the view name.

```typescript
getName(): string
```

**Returns**

The view name.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const views = fBaseTable.getViews()
console.log(views[0]?.getName())
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getPermission`

Returns the View object permission facade.

```typescript
getPermission(): FBaseObjectPermission
```

**Returns**

Permission facade combining the Base, Table, and View Edit points.

**Examples**

```ts
const table = univerAPI.getActiveBase()?.getTables()[0]
const view = table?.getViews()[0]
if (!view) throw new Error('View not found.')
await view.getPermission().setReadOnly()
```

**Types:** [`FBaseObjectPermission`](https://docs.univer.ai/zh-CN/reference/facade/base-object-permission.md)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getProjection`

Get the projected rows and fields for this view.

The projection is computed from the current table snapshot plus this
view's filter, sort, group, field order, visibility, and type-specific
config.

```typescript
getProjection(): BaseViewProjection
```

**Returns**

The projected rows and fields.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
console.log(view.getProjection())
```

**Types:** [`BaseViewProjection`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getSort`

Get the view sort rules.

```typescript
getSort(): ISortConfig[]
```

**Returns**

The sort rules.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
console.log(view.getSort())
```

**Types:** [`ISortConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getType`

Get the view type.

```typescript
getType(): BaseViewType
```

**Returns**

The view type.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const views = fBaseTable.getViews()
console.log(views[0]?.getType())
```

**Types:** [`BaseViewType`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getView`

Get the view snapshot.

```typescript
getView(): IViewSnapshot
```

**Returns**

The view snapshot.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const views = fBaseTable.getViews()
console.log(views[0]?.getView())
```

**Types:** [`IViewSnapshot`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.getVisibleFields`

Get visible fields in this view.

```typescript
getVisibleFields(): FBaseTableField[]
```

**Returns**

An array of visible fields in this view.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
console.log(view.getVisibleFields())
```

**Types:** [`FBaseTableField`](https://docs.univer.ai/zh-CN/reference/facade/base-table-field.md)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.move`

Move this view relative to another view.

```typescript
move(target: { beforeViewId?: string; afterViewId?: string; }): boolean
```

**Parameters**

* `target` — Required. Target position descriptor. Pass exactly one of `beforeViewId` or `afterViewId`.

**Returns**

True if the view was moved, false if the view was already in the target position.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const success = view.move({ beforeViewId: 'calendar' })
console.log(success ? 'View moved' : 'Move view failed')
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.moveField`

Move a field in this view.

```typescript
moveField(fieldId: string, target: { beforeFieldId?: string; afterFieldId?: string; }): boolean
```

**Parameters**

* `fieldId` — Required. The field id.
* `target` — Required. Target position descriptor. Pass exactly one of `beforeFieldId` or `afterFieldId`.

**Returns**

True if the field was moved, false if the field was already in the target position.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const success = view.moveField('status', { afterFieldId: 'title' })
console.log(success ? 'Field moved' : 'Move field failed')
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.setConditionalColorRules`

Replace all conditional coloring rules for this view.

The array order is the rule priority: index `0` is evaluated first.
Passing `[]` clears conditional coloring. Every rule id must be unique,
and every `fieldId` must reference a public field in this table. Invalid
targets, field/operator combinations, date modes, CSS colors, ids, or
fields throw an actionable error before any mutation is executed. For a
`COLUMN` target, the field's entire column is painted unconditionally;
`operator`, `operand`, and `dateMode` are retained but ignored.

Prefer this typed method and `univerAPI.Enum.BaseConditional*` values to
writing `getConfig().conditionalColoring` through `updateConfig`;
the command validates the complete replacement before persisting it.

```typescript
setConditionalColorRules(rules: IBaseConditionalColorRule[]): boolean
```

**Parameters**

* `rules` — Required. Complete replacement rules in descending priority order.

**Returns**

`true` when the update command succeeds; otherwise `false`.

**Examples**

Create a runnable risk table and color high-risk rows

```ts
const base = univerAPI.getActiveBase()
if (!base) throw new Error('Open a Base before running this example.')

const table = base.insertTable(`Risk tracker ${Date.now()}`, {
  primaryFieldName: 'Risk item',
})
const level = table.addField('Risk level', univerAPI.Enum.BaseFieldType.Number)
table.addRecords([
  { values: { [table.getPrimaryFieldId()]: 'Stock shortage', [level.getId()]: 90 } },
  { values: { [table.getPrimaryFieldId()]: 'Delivery delay', [level.getId()]: 60 } },
])

const view = table.getViewByName('Grid')
if (!view) throw new Error('The default Grid view was not created.')
const success = view.setConditionalColorRules([
  {
    id: 'high-risk',
    color: '#fde9e9',
    target: univerAPI.Enum.BaseConditionalColorTarget.ROW,
    fieldId: level.getId(),
    operator: univerAPI.Enum.BaseConditionalColorOperator.GREATER_THAN,
    operand: 80,
  },
])

console.log({ success, rules: view.getConditionalColorRules() })
```

**Types:** [`IBaseConditionalColorRule`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.setFieldVisible`

Show or hide a field in this view.

This changes only the view-local field setting. The table field remains
present and other views are not affected.

```typescript
setFieldVisible(fieldId: string, visible: boolean): boolean
```

**Parameters**

* `fieldId` — Required. The field id.
* `visible` — Required. True to show the field, false to hide it.

**Returns**

True if the visibility was changed, false if the visibility was unchanged.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const success = view.setFieldVisible('progress', false)
console.log(success ? 'Field visibility changed' : 'Set field visibility failed')
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.setFieldWidth`

Set a field width in this view.

```typescript
setFieldWidth(fieldId: string, width: number): boolean
```

**Parameters**

* `fieldId` — Required. The field id.
* `width` — Required. The field width in pixels.

**Returns**

True if the width was set, false if the width was unchanged.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const success = view.setFieldWidth('title', 240)
console.log(success ? 'Field width set' : 'Set field width failed')
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.setFilter`

Set the view filter.

```typescript
setFilter(filter: IFilterConfig | null): boolean
```

**Parameters**

* `filter` — Required. The filter to set, or `null` to clear the filter.

**Returns**

True if the filter was set, false if the filter was unchanged.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')

const fields = fBaseTable.getFields()
const conditions = fields.map((field) => {
  if (field.getId() === 'status') {
    return {
      fieldId: field.getId(),
      operator: univerAPI.Enum.BaseFilterOperator.IS,
      operand: 'done',
    }
  }

  return {
    fieldId: field.getId(),
    operator: univerAPI.Enum.BaseFilterOperator.IS_NOT,
    operand: 'done',
  }
})

const view = fBaseTable.getViewByName('Grid')
const success = view.setFilter({
  conjunction: univerAPI.Enum.BaseFilterConjunction.AND,
  conditions,
})
console.log(success ? 'Filter set' : 'Set filter failed')
```

**Types:** [`IFilterConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.setGroup`

Set the view group rules.

Group rules are view projection metadata. They do not mutate record
values or field definitions.

```typescript
setGroup(group: IGroupConfig[]): boolean
```

**Parameters**

* `group` — Required. Group rules. Pass `[]` to clear grouping.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const success = view.setGroup([
  {
    fieldId: 'status',
    direction: univerAPI.Enum.BaseSortDirection.ASC,
  },
])
console.log(success ? 'Group set' : 'Set group failed')
```

**Types:** [`IGroupConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.setName`

Rename this view.

```typescript
setName(name: string): boolean
```

**Parameters**

* `name` — Required. The new view name.

**Returns**

True if the rename succeeded, false if the name was unchanged.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
if (view) {
  const success = view.setName('Release view')
  console.log(success ? 'View renamed' : 'Rename failed')
}
```

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.setSort`

Set the view sort rules.

```typescript
setSort(sort: ISortConfig[]): boolean
```

**Parameters**

* `sort` — Required. The sort rules.

**Returns**

True if the sort was set, false if the sort was unchanged.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')
const view = fBaseTable.getViewByName('Grid')
const success = view.setSort([
  {
    fieldId: 'priority',
    direction: univerAPI.Enum.BaseSortDirection.ASC,
  },
])
console.log(success ? 'Sort set' : 'Set sort failed')
```

**Types:** [`ISortConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)

### `FBaseTableView.updateConfig`

Update the view-specific config.

```typescript
updateConfig(patch: Partial<ViewSpecificConfig>): boolean
```

**Parameters**

* `patch` — Required. The config fields to update.

**Returns**

True if the update succeeded, false if the config was unchanged.

**Examples**

```ts
const fBase = univerAPI.getActiveBase()
const fBaseTable = fBase.getTableById('table-1')

const view = fBaseTable.getViewByName('Grid')
const gridConfig = view.getConfig() as IGridViewConfig
gridConfig.frozenFieldCount = 2
const success = view.updateConfig(gridConfig)
console.log(success ? 'Config updated' : 'Update failed')
```

**Types:** [`Partial`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts) · [`ViewSpecificConfig`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/bases/typedef.d.ts)

**Package:** [`@univerjs-pro/bases`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs-pro/bases.md) · [Type definitions](https://unpkg.com/@univerjs-pro/bases@1.0.0-rc.0/lib/types/facade/f-view.d.ts)
