I'm using the query below to populate a table. All of the filters are optional to the user - they can choose to enter no filters and get all the data back, or they can enter a title to filter by title, or both title and city...and so on.
I'm having trouble when the user chooses to omit one of the filters. For example, with "state" = AZ I expect to return 20 results, but I only get 10. I've tried passing the title and city in as undefined, null, and "", none of which return the full 20 results.
Please help!
wixData.query("My-Collection")
.contains("title", title)
.contains("city", city)
.contains("state", state)
.find()
.then(res => {
$w("#table1").rows = res.items;
});
If you are getting way too many results being shown at one time, then you can set up your dataset to only show a certain amount.
For tables -
If you have connected the table through a Data Set you can set the LIMIT property in that data set. Just click Manage Dataset and set the limit. Then you can add a pagination element, connect that to the same data set and you are up and running.
https://www.wix.com/corvid/reference/$w.Pagination.html
Through code
https://www.wix.com/corvid/reference/$w.Table.html#pagination
https://www.wix.com/corvid/reference/$w.Table.html#PaginationOptions
For repeaters -
https://www.wix.com/corvid/reference/wix-dataset.html#data-paging
Dataset Pages
Datasets retrieve information from your collections in chunks of items. Each of these chunks is called a page.
A dataset's page size determines how many items are initially displayed in repeaters that are connected to it. Elements that have their own settings for how many items are shown at once, such as tables and galleries, are not affected by the dataset's page size.
Elements that display data from the dataset's current item, such as images and text elements, are affected when you change the current dataset page because the dataset's current item also changes.
You set the page size of a dataset:
In the Editor using the Number of items to display setting in the Dataset Settings panel.
In code using the setPageSize() function.
Through code
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#setPageSize
Have you read about using or from the Wix Data Query in Wix Data API.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#or