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
DML2020DML2020 

Filter results for LWC that includes a search field

Within the LWC, there exists a search field which displays properties for the user to select. The html file contains the following: 

<lightning-layout multiple-rows class="slds-var-p-bottom_small">
                <lightning-layout-item size="4">
                    <lightning-input
                            type="search"
                            label="Search Properties"
                            onchange={handleSearch}
                            class="slds-var-p-right_small">
                    </lightning-input>
                </lightning-layout-item>

which is dictated by the following in the js file as follows:

handleSearch(event) {
    const searchFields = ['name', 'propertyId', 'address'];
    this.template
      .querySelector('c-datatable')
      .search(event.target.value, searchFields);
  }
 

Question: The properties that are returned have a status of either ACTIVE or INACTIVE. However, the requirement is for the properties to return ones ONLY with the status of ACTIVE (filter for only ACTIVE status on the record and exclude those of INACTIVE status). 

Where would I navigate to edit the filter to make the update to accomplish this?

 

SwethaSwetha (Salesforce Developers) 
HI,
How is the c-datatable component structured? Is it a custom component, and does it have a method like search or updateProperties that can be used to filter and update the displayed properties?

Related posts:
https://salesforce.stackexchange.com/questions/300822/lwc-lookup-filter-based-on-account-lookup
https://www.salesforceben.com/building-a-lightning-web-component-lwc-to-filter-related-records/
https://studysection.com/blog/how-to-show-list-of-related-records-using-search-filter-in-lwc/
https://www.infallibletechie.com/2022/01/filtersearch-in-lightning-datatable-in.html

Thanks