filter( )


Creates a filter to be used with datasets and aggregations.

The filter() function builds a filter to be applied to a dataset or an aggregation, and returns a WixDataFilter object. The returned object contains the filter definition and is used with the setFilter() function.

When working with Wix app collections, check which fields can be used in a filter.

Method Declaration
Copy
function filter(): WixDataFilter;
Request
This method does not take any parameters
Returns
Return Type:WixDataFilter
Filter a dataset
JavaScript
import wixData from "wix-data"; // ... $w("#myDataset").setFilter( wixData.filter().startsWith("lastName", "D").ge("age", "21"), );
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?