Skip to main content

View

Get view information and records under the specified view

view.View

Parameters​

id​

• get id(): string

View id, unique identification of view

Returns​

string

Example​

console.log(myView.id);
// => 'viwxxxxxx'

name​

• get name(): string

View Name

Returns​

string

Example​

console.log(myView.name);
// => 'test'

type​

• get type(): ViewType

View Type

Returns​

ViewType

Example​

console.log(myView.type);
// => "Grid"

url​

• get url(): string

The URL address of the view, you can access this address in the browser, open the AITable and navigate to the corresponding view

Returns​

string

Example​

console.log(myView.url);
// => 'https://aitable.ai/workbench/dstxxxxxx/viwxxxxxx'

Methods​

getRecordAsync​

▸ getRecordAsync(recordId): Record

Gets the specified record

Parameters​

NameTypeDescription
recordIdstringRecord ID

Returns​

Record

Example​

console.log(myView.getRecordAsync('recxxxxxx')); // => Record

getRecordsAsync​

▸ getRecordsAsync(options?): Record[]

Bulk fetch specified records

Parameters​

NameTypeDescription
options?Object-
options.recordIds?[]Set of record ID
options.sorts[]Records need to be sorted by which fields

Returns​

Record[]

Example​

console.log(myView.getRecordsAsync()); // => [Record, Record, ...] console.log(myView.getRecordsAsync({ recordIds: ['recxxxxxx01', 'recxxxxxx02'] })); // => [Record, Record]