I have written wire and if data is received successfully I am calling function in which apex method is called imperatively, so how can I refresh results of that apex call for example on button click without refreshing the whole page? I tried to use refreshApex but that can only be used with wired result but it is not refreshing data which is returned after I call the function inside that wire, so here is the code:
import {
LightningElement,
track,
wire
} from 'lwc';
export default class Sf_addProducts extends LightningElement {
records = [];
@wire(getFieldsLabelsMap) wiredQlis(result) {
if (result.data) {
this.getQliRecords(result.data);
} else if (result.error) {
console.log(result.error);
}
}
}
getRecords(fldsMap) {
getQlis({
quoteId: this.quoteId,
fieldsToQUery: fieldNames
}).then(res = {
if (res.length > 0) {
this.records = res;
}
})
}
handleButtonClick() { //refresh getRecords without refreshin the whole page
}