Skip to content

useListView

Import

import { mix, useListView, BoltElement } from 'c/boltage';

Usage

export default class myLwc extends mix(
BoltElement,
useListView({
listViewApiName,
objectApiName,
recordsPerPage,
optionalFields,
sort: {
by,
direction
}
})
) { }

Constructor

NameTypeDefaultDescription
listViewApiNameStringApi Name of the list view you wish to use
objectApiNameStringApi name of the object the listview belongs to
recordsPerPage?Number50Number of records loaded per page
optionalFields?Field[]List of imported fields you wish to be present on the <Sobject>__info dynamic prop
sort?{by: string, direction: string}Defines how to sort records of the listview

Properties

ListViewData : Object[]

<lightning-datatable
data={ListViewData}
></lightning-datatable>

ListViewColumns : Object[]

<lightning-datatable
columns={ListViewColumns}
></lightning-datatable>

PageSizeOptions : Object[]

<lightning-combobox
options={PageSizeOptions}
></lightning-combobox>

Implementable getters

get customColumns() : Object

export default class myLwc extends mix(
BoltElement,
useListView({
listViewApiName: 'myListView',
objectApiName: 'Case',
optionalFields: [foobar__c]
})
) {
get customColumns() {
return {
someField__c: {
type: 'someCustomType',
fieldName: 'someField__c',
label: 'Some custom label',
sortable: true,
initialWidth: 200,
typeAttributes: { customAttribute: {fieldName: 'foobar__c'} }
}
}
}
}