setFilter( )
Sets the dataset filter.
The setFilter()
function filters out items that don't match the filter
criteria.
The WixDataFilter
object is created by calling the filter()
function on wixData
and chaining one or more of the following Wix Data
filter functions.
- and: See note below.
- ascending
- between
- contains
- descending
- endsWith
- eq
- ge
- gt
- hasAll
- hasSome
- isEmpty
- isNotEmpty
- le
- lt
- ne
- not: See note below.
- or: See note below.
- startsWith
Setting a dataset's filter overrides existing filters that were previously
set using the setFilter()
function or using the Dataset Settings
panel in the Editor.
To clear a dataset's current filter, call setFilter()
and pass it an
empty filter. You create an empty filter by calling the filter()
function without chaining any of the additional filter functions mentioned above.
Calling setFilter()
on a write-only dataset causes an error.
You will need to import wix-data
in order to create a WixDataFilter
object.
Notes:
- When using the and, not, or or functions, be sure to pass them a
WixDataFilter
object created by calling thefilter()
function and not aWixDataQuery
object. - When using a read-write dataset and linked input elements, calling any of the following functions will save any changes made in the linked input elements.
A wix-data filter object.