function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandile matheSandile mathe 

LWC data table filter

Hi Guys. Has anyone worked on the LWC where you have to filter the Data table based on the User Input. Example: data table showing list of Opportunities list at the top of the table have a field with values(Picklist), lets says STAGE. if the user chooses stage value then the table should show the list with the selected results(Stage = "Closed won"). I spent days trying to archive this but failed to make it work, I have very few experience with LWC.
VinayVinay (Salesforce Developers) 
Hi Sandile,

This is out of box functionality you might need to build your own filter button.

https://salesforce.stackexchange.com/questions/288739/filter-for-datatable-in-lwc

Thanks,
Vinay Kumar
{tushar-sharma}{tushar-sharma}
Hi Sandile,

As this is not available OOTB, So you need to develop it.
You can take reference from here: https://newstechnologystuff.com/2019/03/24/lightning-web-components-datatable-with-lazy-loading-inline-edit-and-dynamic-row-action/

Create a dropdown and once user make any changes, pass that variable in controller method and in the query add that as filter. With minimal changes you can get the required functionality.

If this answer helps you, please mark it as accepted.

Regards,
Tushar Sharma
https://newstechnologystuff.com/