View
能够获取视图信息和指定视图下的记录
view.View
配件
id
• get
id(): string
视图 id, 视图的唯一标识
返回值
string
示例
console.log(myView.id);
// => 'viwxxxxxx'
name
• get
name(): string
视图名称
返回值
string
示例
console.log(myView.name);
// => '测试视图'
type
• get
type(): ViewType
视图类型
返回值
示例
console.log(myView.type);
// => "Grid"
url
• get
url(): string
视图的 URL 地址,你可以在浏览器中访问这个地址,打开维格表界面并定位到对应视图
返回值
string
示例
console.log(myView.url);
// => 'https://vika.cn/workbench/dstxxxxxx/viwxxxxxx'
方法
getRecordAsync
▸ getRecordAsync(recordId
): Record
获取指定记录
参数
Name | Type | Description |
---|---|---|
recordId | string | 记录 ID |
返回值
示例
console.log(myView.getRecordAsync('recxxxxxx')); // => Record
getRecordsAsync
▸ getRecordsAsync(options?
): Record
[]
批量获取指定记录
参数
Name | Type | Description |
---|---|---|
options? | Object | - |
options.recordIds? | [] | 记录 ID 的集合 |
options.sorts | [] | 记录需要根据哪些字段进行排序 |
返回值
Record
[]
示例
console.log(myView.getRecordsAsync()); // => [Record, Record, ...]
console.log(myView.getRecordsAsync({ recordIds: ['recxxxxxx01', 'recxxxxxx02'] })); // => [Record, Record]