Salesforce Asked on January 6, 2022
I’ve created a lightning-datatable and I’m trying to filter records in the lightning-datatable using a custom search box. However, it displays a pop-up with error which says SORRY TO INTERRUPT -> the page has error when I try to filter the records.
Below is the code I’ve written to filter records in data-table.
handleSearch(event){
var searchText = event.target.value;
console.log('searchText : ' ,searchText);
try{
this.dataListTemp = this.dataListTemp.filter(function (record) {
return record.name.includes(searchText) ||
record.title.includes(searchText) ||
record.occupation.includes(searchText);
});
}catch(error){
console.log('Error : ' ,error);
}
}
dataListTemp is assigned to the data attribute of lightning-datatable and handleSearch is called onchange of text in search box.
I used try-catch just to figure out what’s causing this error but catch isn’t called at all.
What is the issue here?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP