I am using following LWC wrapper in aura to get list views:
LWC:
import { LightningElement, wire, track, api } from 'lwc';
import { getListUi } from 'lightning/uiListApi';
export default class WireListView extends LightningElement {
@api objectApiName;
@api listViewApiName;
@wire(getListUi, {
objectApiName: '$objectApiName',
listViewApiName: '$listViewApiName'
})
listView
@api get result(){
return this.listView;
}
}
Aura:
<aura:handler name="change" value="{!v.myList}" action="{!c.listViewChange}"/>
<DecsOnD:wireListView
aura:id="wireListView"
listViewApiName="{!!empty(v.selectedView.NamespacePrefix)
? v.selectedView.NamespacePrefix + '__' + v.selectedView.DeveloperName
: v.selectedView.DeveloperName}"
objectApiName="{!v.selectedObject}"
result="{!v.myList}"/>
I've got couple of problems:
- I need to change v.selectedView.DeveloperName couple for times so that actual record propagates. I suspect this due to how
@api get reusult
works - it returns previous record - My change handler fires twice, which is sort of ok, but wondering why - I suspect because I'm passing two attributes?
- On init getListUi seems to retrieve a list of list views - which would be very useful if I can understand how it works exactly :) ATM I am using SOQL query, but in future I could use this instead.