We are excited to announce the following recent additions to the Wix Code API.
isEmpty() / isNotEmpty()
You can now refine your wix-data queries to only match items where a specified property is empty or is not empty. A property is considered empty if it doesn’t exist, is null, or is undefined.
Example: Retrieve author items that have a non-empty bio.
import wixData from 'wix-data';
// ...
wixData.query("authors")
.isNotEmpty("bio")
.find()
.then( (results) => {
// do something with the results
} )
.catch( (error) => {
// handle the error
} );
To learn more, see isEmpty and isNotEmpty in the API reference.
Dataset Paging APIs
You can now work with your dataset’s pages using the following wix-dataset APIs:
-
getCurrentPageIndex() - Gets the index of the dataset’s current page.
-
getPageSize() - Gets the dataset’s page size.
-
getTotalPageCount() - Gets the number of pages in the dataset.
-
hasNextPage() - Indicates if there is a next page of data.
-
hasPreviousPage() - Indicates if there is a previous page of data.
-
loadMore() - Loads the next page of data in addition to the current data.
-
loadPage() - Loads the specified page.
-
nextPage() - Moves to the next page of data.
-
previousPage() - Moves to the previous page of data.
-
setPageSize() - Sets the dataset’s page size.
To learn more about dataset paging, see Data Paging in the API Reference.
postMessage()
If your site is embedded within another site, you can now use the wix-window postMessage() function to send messages from the inner site to the outer one.
To learn more, see postMessage() in the API Reference.