diff --git a/dbsm-viewer-app/wix-dataset.service.json b/dbsm-viewer-app/wix-dataset.service.json deleted file mode 100644 index b7b08d0e82..0000000000 --- a/dbsm-viewer-app/wix-dataset.service.json +++ /dev/null @@ -1,78 +0,0 @@ -{ "name": "wix-dataset", - "mixes": [], - "labels": [], - "location": - { "lineno": 1, - "filename": "datasetApi.js" }, - "docs": - { "summary": "A dataset connects page elements to a set of items in a data collection.", - "description": - [ "A dataset serves as an intermediary between page elements, such as input", - " elements and buttons, and the data in a collection. The dataset", - " controls which collection is available to be used by page elements, what", - " those elements can do with the collection data (display, add, modify),", - " which item is currently active, and whether the data is filtered or sorted.", - "", - " A dataset can be in one of three modes, which are set in Dataset Settings", - " panel in the Editor. The dataset's mode cannot be changed programmatically.", - "", - " + **Read & Write**: Display and modify data.", - " + **Read-only**: Display data.", - " + **Write-only**: Add new data.", - "", - "", - " ![Dataset modes](images/dataset_modes.png \"Dataset modes\")", - "", - " >**Note:** When creating a dataset for a [single item collection](https://support.wix.com/en/article/about-collections-with-a-single-item), the dataset can only be in **Read-only** mode.", - "", - " Another way to work with collection data and page elements is to use the", - " [Data API](wix-data.html). The Data API lets you work directly with your", - " collections. However, you'll need to write code to read from and write to", - " your page elements. Using the Dataset API allows you to take advantage of", - " the [data binding](https://support.wix.com/en/article/data-binding) that", - " can be set up in the Editor's connect panels.", - "", - " The wix-dataset API can only be used in your site’s front-end code.", - "", - " You do not need to import `wix-dataset`.", - "", - " ### 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()`](wix-dataset.Dataset.html#setPageSize) function." ], - "links": [], - "examples": [], - "extra": - { } }, - "properties": [], - "operations": [], - "callbacks": [], - "messages": [], - "extra": - { "scopes": - [ "frontend" ] }, - "menuSections": "APIs", - "relatedContent": - [ { "icon": "example", - "text": "Checkbox Dropdown", - "url": "https://www.wix.com/velo/example/checkbox-dropdown" }, - { "icon": "example", - "text": "Product Configurator", - "url": "https://www.wix.com/velo/example/product-configurator" }, - { "icon": "example", - "text": "Print on Demand", - "url": "https://www.wix.com/velo/example/print-on-demand" } ] } \ No newline at end of file diff --git a/dbsm-viewer-app/wix-dataset/Dataset.service.json b/dbsm-viewer-app/wix-dataset/Dataset.service.json deleted file mode 100644 index 43a3f5b791..0000000000 --- a/dbsm-viewer-app/wix-dataset/Dataset.service.json +++ /dev/null @@ -1,2677 +0,0 @@ -{ "name": "Dataset", - "memberOf": "wix-dataset", - "mixes": [], - "labels": [], - "location": - { "lineno": 56, - "filename": "datasetApi.js" }, - "docs": - { "summary": "A [dataset](wix-dataset.html) connects page elements to a set of items in a data collection.", - "links": [], - "examples": [], - "extra": - { } }, - "properties": [], - "operations": - [ { "name": "add", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When a new empty item is the current item of the dataset.\nRejected - An error message." }, - "locations": - [ { "lineno": 654, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Adds a new blank item.", - "description": - [ "The `add()` function saves the current item and then adds a new blank", - " item. When the editing of the new item is complete, you will need to", - " call another function that will save the new item.", - "", - " The index of the new item is one after the index of the current item, or", - " zero if there is no current item.", - "", - " Note that since the `add()` function begins by saving the current item,", - " if the current item cannot be saved for any reason, such as it does not", - " pass validation, calling the function will cause an error.", - "", - " Calling `add()` on a read-only dataset causes an error.", - "", - " > **Notes:**", - " >", - " > A dataset needs to load its data before you call its `add()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `add()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `add()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading.", - " > ", - " > This function replaces the deprecated [`new()`](https://www.wix.com/velo/reference/wix-dataset/dataset/new) function. The deprecated function will continue to work, but will not receive updates." ], - "links": [], - "examples": - [ { "title": "Save the current item and add a new blank item", - "body": - [ "$w(\"#myDataset\").add()", - " .then( ( ) => {", - " console.log(\"New item added\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );" ], - "extra": - { } }, - { "title": "Save the current item and add a new blank item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").add()", - " .then( ( ) => {", - " console.log(\"New item added\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getCurrentItem", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "Object", - "doc": "The current item, or null if there is no current item." }, - "locations": - [ { "lineno": 240, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Returns the current item.", - "description": - [ "The `getCurrentItem()` function returns an object whose key:value pairs", - " are the field IDs and field values of the current item, including all", - " hidden fields. Fields that do not have a value are omitted from the", - " returned object.", - "", - " When called on a write-only or read & write dataset,", - " `getCurrentItem()` returns the unsaved state of the current item.", - "", - " Returns `null` or `undefined` if the dataset:", - "", - " + Is filtered to not match any items in the collection.", - " + Is empty.", - " + Has not loaded yet.", - "", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `getCurrentItem()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `getCurrentItem()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `getCurrentItem()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading.", - " >", - " > If the current item is changed from a non-dataset source, such as by", - " > selecting a row in a table connected to a dataset or clicking a button set", - " > to advance to the next item in a dataset, the dataset's current item is", - " > not updated immediately. Therefore, to get the dataset's new current item,", - " > call `getCurrentItem()` in the dataset's [`onCurrentIndexChanged()`](#onCurrentIndexChanged)", - " > event handler. Do not use the events of the non-dataset source, such as", - " > [`onRowSelect`]($w.Table.html#onRowSelect) or `onClick`,", - " > to call `getCurrentItem()` because they will fire before the dataset's", - " > current item is updated." ], - "links": - [ "[getCurrentItemIndex( )](#getCurrentItemIndex)", - "[setCurrentItemIndex( )](#setCurrentItemIndex)" ], - "examples": - [ { "title": "Get the dataset's current item", - "body": - [ "let itemObj = $w(\"#myDataset\").getCurrentItem();", - "", - "/* ", - " * {", - " * \"_id\": \"fcec780a-3e37-4b64-8a66-37c552c53f99\",", - " * \"_owner\": \"f6c0f9c3-a62d-7e9f-g58d-943829af244d9\",", - " * \"_createdDate\": \"2017-05-01T17:19:03.823Z\",", - " * \"_updatedDate\": \"2017-05-01T17:19:10.477Z\",", - " * \"title\": \"Dr. \",", - " * \"name\": \"B\",", - " * \"link-dynamic-name\": \"/myCollection/B\"", - " * }", - " */" ], - "extra": - { } }, - { "title": "Get the dataset's current item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " let itemObj = $w(\"#myDataset\").getCurrentItem();", - "", - " } );", - "", - "} );", - "", - "/* itemObj:", - " *", - " * {", - " * \"_id\": \"fcec780a-3e37-4b64-8a66-37c552c53f99\",", - " * \"_owner\": \"f6c0f9c3-a62d-7e9f-g58d-943829af244d9\",", - " * \"_createdDate\": \"2017-05-01T17:19:03.823Z\",", - " * \"_updatedDate\": \"2017-05-01T17:19:10.477Z\",", - " * \"title\": \"Dr. \",", - " * \"name\": \"B\",", - " * \"link-dynamic-name\": \"/myCollection/B\"", - " * }", - " */" ], - "extra": - { } }, - { "title": "Get the dataset's current item when an item is clicked in a repeater", - "body": - [ "$w.onReady( function () {", - " $w(\"#repeatedContainer\").onClick( (event) => {", - " let $item = $w.at(event.context);", - " let clickedItemData = $item(\"#myDataset\").getCurrentItem();", - " } );", - "} );" ], - "extra": - { "description": "This example demonstrates how to get an item's details using the `at()` function. We use this\n function to establish context when a repeater container is clicked." } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getCurrentItemIndex", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "number", - "doc": "The index of the current item, or null if there is no current item." }, - "locations": - [ { "lineno": 293, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Returns the current item's index.", - "description": - [ "The `getCurrentItemIndex()` function returns the index of current item", - " within the items of the dataset. The indices of the items in a dataset", - " are zero-based. For example, if the third item is the current item, then", - " `getCurrentItemIndex()` returns `2`.", - "", - " Calling `getCurrentItemIndex()` on a write-only dataset causes an error.", - "", - " Returns `null` if one of the following is true if the dataset:", - "", - " + Is filtered to not match any items in the collection.", - " + Is empty.", - " + Has not loaded yet.", - "", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `getCurrentItemIndex()` function.", - "> Usually a dataset finishes loading a short time after the page it is on finishes", - "> loading. So if you call `getCurrentItemIndex()` inside the page’s [`onReady()`]($w.html#onReady)", - "> event handler, the dataset might not be ready yet.", - " >", - " > To call `getCurrentItemIndex()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading.", - " >", - " > If the current item is changed from a non-dataset source, such as by", - " > selecting a row in a table connected to a dataset or clicking a button set", - " > to advance to the next item in a dataset, the dataset's current item is", - " > not updated immediately. Therefore, to get the dataset's new current item index,", - " > call `getCurrentItemIndex()` in the dataset's [`onCurrentIndexChanged()`](#onCurrentIndexChanged)", - " > event handler. Do not use the events of the non-dataset source, such as", - " > [`onRowSelect`]($w.Table.html#onRowSelect) or `onClick`,", - " > to call `getCurrentItemIndex()` because they will fire before the dataset's", - " > current item is updated." ], - "links": - [ "[setCurrentItemIndex( )](#setCurrentItemIndex)", - "[getCurrentItem( )](#getCurrentItem)" ], - "examples": - [ { "title": "Get the current item's index", - "body": - [ "let itemIndex = $w(\"#myDataset\").getCurrentItemIndex(); // 3" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getCurrentPageIndex", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "number", - "doc": "The index of the current page or null if there is no current page." }, - "locations": - [ { "lineno": 1311, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Gets the index of the dataset's current page.", - "description": - [ "The `getCurrentPageIndex()` function returns the index of current dataset", - " [page](wix-dataset/introduction#dataset-pages). The indices of the dataset's pages start at `1`.", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `getCurrentPageIndex()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `getCurrentPageIndex()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `getCurrentPageIndex()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": [], - "examples": - [ { "title": "Get the current page's index", - "body": - [ "let pageCount = $w(\"#myDataset\").getCurrentPageIndex(); // 1" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getItems", - "labels": [], - "nameParams": [], - "params": - [ { "name": "fromIndex", - "type": "number", - "doc": "The index of the first item to return." }, - { "name": "numberOfItems", - "type": "number", - "doc": "The number of items to return." } ], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "wix-dataset.Dataset.GetItemsResult" ] }, - "doc": "Fulfilled - The items retrieved and the total number of items in the dataset that match its filter criteria.\nRejected - An error object." }, - "locations": - [ { "lineno": 181, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Returns the selected items.", - "description": - [ "The `getItems()` function returns a Promise that is resolved to", - " a `GetItemsResult` object when the items have been", - " retrieved.", - "", - " Calling `getItems()` on a write-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `getItems()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `getItems()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `getItems()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[getCurrentItem( )](#getCurrentItem)" ], - "examples": - [ { "title": "Get items from the dataset", - "body": - [ "$w(\"#myDataset\").getItems(3, 2)", - " .then( (result) => {", - " let items = result.items;", - " let totalCount = result.totalCount;", - " let offset = result.offset;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );" ], - "extra": - { } }, - { "title": "Get items from the dataset when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").getItems(3, 2)", - " .then( (result) => {", - " let items = result.items;", - " let totalCount = result.totalCount;", - " let offset = result.offset;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getPageSize", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "number", - "doc": "The page size." }, - "locations": - [ { "lineno": 1382, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Gets the dataset's page size.", - "description": - [ "Gets the current [page](wix-dataset/introduction#dataset-pages) size set in the Editor or using the", - " [`setPageSize`](#setPageSize) function." ], - "links": - [ "[setPageSize( )](#setPageSize)" ], - "examples": - [ { "title": "Get the current page size", - "body": - [ "let pageSize = $w(\"#myDataset\").getPageSize(); // 6" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getTotalCount", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "number", - "doc": "The number of items in the dataset that match its filter criteria." }, - "locations": - [ { "lineno": 216, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Returns the number of items in the dataset that match its filter criteria.", - "description": - [ "Calling `getTotalCount()` on a write-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `getTotalCount()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `getTotalCount()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `getTotalCount()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": [], - "examples": - [ { "title": "Get the number of items in the dataset that match its filter criteria", - "body": - [ "let count = $w(\"#myDataset\").getTotalCount(); // 23" ], - "extra": - { } }, - { "title": "Get the number of items in the dataset that match its filter criteria when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " let count = $w(\"#myDataset\").getTotalCount(); // 23", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getTotalPageCount", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "number", - "doc": "The number of pages in the dataset." }, - "locations": - [ { "lineno": 1284, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Gets the number of pages in the dataset.", - "description": - [ "The number of [pages](wix-dataset/introduction#dataset-pages) in a dataset is the number of total items divided", - " by the page size. If there are any left over items, one more page is added.", - "", - " For example, if you have 20 items and your page size is 6, you have", - " 4 pages. The first 3 pages have 6 items each and the last page has 2 items.", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `getTotalPageCount()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `getTotalPageCount()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `getTotalPageCount()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": [], - "examples": - [ { "title": "Get the number of pages in the dataset", - "body": - [ "let pageCount = $w(\"#myDataset\").getTotalPageCount(); // 4" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "hasNext", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "boolean", - "doc": "`true` if the current item is not the last item in the dataset." }, - "locations": - [ { "lineno": 554, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Indicates if there is a next item.", - "description": - [ "Returns `true` if the current item is not the last item in the dataset.", - "", - " Returns `false` if the current item is the last item in the dataset.", - "", - " Calling `hasNext()` on a write-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `hasNext()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `hasNext()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `hasNext()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[hasPrevious( )](#hasPrevious)" ], - "examples": - [ { "title": "Get whether the current item is the last item", - "body": - [ "let hasNext = $w(\"#myDataset\").hasNext(); // true" ], - "extra": - { } }, - { "title": "Get whether the current item is the last item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " let hasNext = $w(\"#myDataset\").hasNext(); // true", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "hasNextPage", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "boolean", - "doc": "`true` if the current page is not the last page in the dataset." }, - "locations": - [ { "lineno": 1221, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Indicates if there is a next page of data.", - "description": - [ "Returns `true` if the current [page](wix-dataset/introduction#dataset-pages) is not the last", - " [page](wix-dataset/introduction#dataset-pages) in the dataset.", - "", - " Returns `false` if the current [page](wix-dataset/introduction#dataset-pages) is the last", - " [page](wix-dataset/introduction#dataset-pages) in the dataset.", - "", - " Calling `hasNextPage()` on a write-only dataset causes an error.", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `hasNextPage()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `hasNextPage()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `hasNextPage()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[nextPage( )](#previousPage)", - "[hasPreviousPage( )](#hasNextPage)" ], - "examples": - [ { "title": "Get whether the current page is the last page of data", - "body": - [ "let hasNextPage = $w(\"#myDataset\").hasNextPage(); // true" ], - "extra": - { } }, - { "title": "Get whether the current page is the last page of data when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " let hasNextPage = $w(\"#myDataset\").hasNextPage(); // true", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "hasPrevious", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "boolean", - "doc": "`true` if the current item is not the first item in the dataset." }, - "locations": - [ { "lineno": 584, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Indicates if there is a previous item.", - "description": - [ "Returns `true` if the current item is not the first item in the dataset.", - "", - " Returns `false` if the current item is the first item in the dataset.", - "", - " Calling `hasPrevious()` on a write-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `hasPrevious()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `hasPrevious()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `hasPrevious()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[hasNext( )](#hasNext)" ], - "examples": - [ { "title": "Get whether the current item is the first item", - "body": - [ "let hasPrevious = $w(\"#myDataset\").hasPrevious(); // true" ], - "extra": - { } }, - { "title": "Get whether the current item is the first item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " let hasPrevious = $w(\"#myDataset\").hasPrevious(); // true", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "hasPreviousPage", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "boolean", - "doc": "`true` if the current page is not the first page in the dataset." }, - "locations": - [ { "lineno": 1252, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Indicates if there is a previous page of data.", - "description": - [ "Returns `true` if the current [page](wix-dataset/introduction#dataset-pages) is not the first", - " [page](wix-dataset/introduction#dataset-pages) in the dataset.", - "", - " Returns `false` if the current [page](wix-dataset/introduction#dataset-pages) is the first", - " [page](wix-dataset/introduction#dataset-pages) in the dataset.", - "", - " Calling `hasPreviousPage()` on a write-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `hasPreviousPage()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `hasPreviousPage()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `hasPreviousPage()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[previousPage( )](#previousPage)", - "[hasNextPage( )](#hasNextPage)" ], - "examples": - [ { "title": "Get whether the current page is the first page of data", - "body": - [ "let hasPreviousPage = $w(\"#myDataset\").hasPreviousPage(); // true" ], - "extra": - { } }, - { "title": "Get whether the current page is the first page of data when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " let hasPreviousPage = $w(\"#myDataset\").hasPreviousPage(); // true", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "loadMore", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the additional data has been loaded and any connected repeaters have been updated.\nRejected - An error message." }, - "locations": - [ { "lineno": 1076, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Loads the next page of data in addition to the current data.", - "description": - [ "The `loadMore()` function returns a Promise that is resolved", - " when:", - "", - " + The dataset loads the next [page of data](wix-dataset/introduction#dataset-pages).", - " + Any connected elements have been updated with the new data.", - "", - "", - " Loading more data into a dataset adds more items to any connected", - " repeaters. Elements that have their own settings for how many items", - " are shown at once, such as tables and galleries, are not affected.", - "", - " Loading more data into a dataset does not:", - "", - " + Remove any of the items that were previously shown in any connected elements", - " + Change the dataset's [page](wix-dataset/introduction#dataset-pages) size.", - " + Change the dataset's current item.", - "", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `loadMore()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `loadMore()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `loadMore()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": [], - "examples": - [ { "title": "Load more dataset content", - "body": - [ "$w(\"#myDataset\").loadMore()", - " .then( () => {", - " console.log(\"Done loading more data\");", - " } );" ], - "extra": - { } }, - { "title": "Load more dataset content when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").loadMore()", - " .then( () => {", - " console.log(\"Done loading more data\");", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "loadPage", - "labels": [], - "nameParams": [], - "params": - [ { "name": "pageIndex", - "type": "number", - "doc": "The index of the page to load." } ], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ { "name": "Array", - "typeParams": - [ "Object" ] } ] }, - "doc": "Fulfilled - When the specified page has been loaded and any connected elements have been updated.\nRejected - An error message." }, - "locations": - [ { "lineno": 1335, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Loads the specified page.", - "description": - [ "The `loadPage()` function returns a Promise that is resolved to", - " an array of the specified [page](wix-dataset/introduction#dataset-pages)'s items when:", - "", - " + The current item is saved in the collection (if necessary).", - " + The specified [page of data](wix-dataset/introduction#dataset-pages) is loaded.", - " + Any connected elements have been updated with the new data.", - " + The current item is updated to the first item in the loaded page.", - "", - "", - " The indices of the dataset's [pages](wix-dataset/introduction#dataset-pages) start at `1`.", - "", - "> **Notes:**", - " > + A dataset needs to load its data before you call its `loadPage()` function. ", - " >", - " > Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call `loadPage()` inside the page’s [`onReady()`]($w.html#onReady) event handler, the dataset might not be ready yet.", - " > ", - "> To call `loadPage()` as soon as possible after a page loads, use the **dataset's** [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady) event handler to ensure that both the page and the dataset have finished loading.", - " > + 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. ", - "> + [setFilter()](wix-dataset/dataset/set-filter)", - "> + [setSort()](wix-dataset/dataset/set-sort)", - "> + [nextPage()](wix-dataset/dataset/next-page)", - "> + [previousPage()](wix-dataset/dataset/previous-page)", - "> + [loadPage()](wix-dataset/dataset/load-page)", - "> + [setPageSize()](wix-dataset/dataset/set-page-size)", - "> + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - "> + [next()](wix-dataset/dataset/next)", - "> + [previous()](wix-dataset/dataset/previous)", - "> + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[previousPage( )](#previousPage)", - "[nextPage( )](#nextPage)" ], - "examples": - [ { "title": "Move to the fourth page of dataset content", - "body": - [ "$w(\"#myDataset\").loadPage(4)", - " .then( (items) => {", - " let firstItem = items[0];", - " let fieldValue = firstItem.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );" ], - "extra": - { } }, - { "title": "Move to the fourth page of dataset content when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").loadPage(4)", - " .then( (items) => {", - " let firstItem = items[0];", - " let fieldValue = firstItem.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "new", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When a new empty item is the current item of the dataset.\nRejected - An error message." }, - "locations": - [ { "lineno": 614, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "**Deprecated.**\nThis function will continue to work, but a newer version is available. Use the\n[`add()`](https://www.wix.com/velo/reference/wix-dataset/dataset/add) function instead.", - "description": - [ "Creates a new blank item.", - "", - " The `new()` function saves the current item and then creates a new blank", - " item. When the editing of the new item is complete, you will need to", - " call another function that will save the new item.", - "", - " The index of the new item is one after the index of the current item, or", - " zero if there is no current item.", - "", - " Note that since the `new()` function begins by saving the current item,", - " if the current item cannot be saved for any reason, such as it does not", - " pass validation, calling the function will cause an error.", - "", - " Calling `new()` on a read-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `new()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `new()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `new()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": [], - "examples": - [ { "title": "Save the current item and create a new blank item", - "body": - [ "// NOTE: This example uses the new add() ", - "// function, which replaces new(). ", - "// See the function description for more information, and ", - "// line 14 for the deprecated example.", - "", - "$w(\"#myDataset\").add()", - " .then( ( ) => {", - " console.log(\"New item created\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - "// NOTE: This example uses the deprecated new() function.", - "", - " $w(\"#myDataset\").new()", - " .then( ( ) => {", - " console.log(\"New item created\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );" ], - "extra": - { } }, - { "title": "Save the current item and create a new blank item when the page loads", - "body": - [ "// NOTE: This example uses the new add() ", - "// function, which replaces new(). ", - "// See the function description for more information, and ", - "// line 20 for the deprecated example.", - "", - "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").add()", - " .then( ( ) => {", - " console.log(\"New item created\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - " } );", - " ", - "} );", - "", - "// NOTE: This example uses the deprecated new() function.", - "", - "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").new()", - " .then( ( ) => {", - " console.log(\"New item created\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "next", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "Object" ] }, - "doc": "Fulfilled - The next item in the dataset.\nRejected - An error message." }, - "locations": - [ { "lineno": 460, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Saves the current item and moves to the next item.", - "description": - [ "The `next()` function returns a Promise that is resolved to the next item", - " when:", - "", - " + The current item is saved in the collection (if necessary).", - " + Any connected page elements have been updated with the new current item’s values.", - "", - "", - " Calling `next()` on a write-only dataset causes the", - " Promise to reject.", - "", - " If the dataset is read-write, the current item is saved even if there is", - " no next item.", - "", - " > **Notes:**", - " > + A dataset needs to load its data before you call its `next()` function. ", - " >", - " > Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call `next()` inside the page’s [`onReady()`]($w.html#onReady) event handler, the dataset might not be ready yet.", - " > ", - "> To call `next()` as soon as possible after a page loads, use the **dataset's** [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady) event handler to ensure that both the page and the dataset have finished loading.", - " > + 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. ", - "> + [setFilter()](wix-dataset/dataset/set-filter)", - "> + [setSort()](wix-dataset/dataset/set-sort)", - "> + [nextPage()](wix-dataset/dataset/next-page)", - "> + [previousPage()](wix-dataset/dataset/previous-page)", - "> + [loadPage()](wix-dataset/dataset/load-page)", - "> + [setPageSize()](wix-dataset/dataset/set-page-size)", - "> + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - "> + [next()](wix-dataset/dataset/next)", - "> + [previous()](wix-dataset/dataset/previous)", - "> + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[previous( )](#previous)", - "[hasNext( )](#hasNext)" ], - "examples": - [ { "title": "Move to the next item", - "body": - [ "$w(\"#myDataset\").next()", - " .then( (item) => {", - " let fieldValue = item.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );" ], - "extra": - { } }, - { "title": "Move to the next item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").next()", - " .then( (item) => {", - " let fieldValue = item.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "nextPage", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ { "name": "Array", - "typeParams": - [ "Object" ] } ] }, - "doc": "Fulfilled - When the next page of data has been loaded and any connected elements have been updated.\nRejected - An error message." }, - "locations": - [ { "lineno": 1119, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Moves to the next page of data.", - "description": - [ "The `nextPage()` function returns a Promise that is resolved to", - " an array of the next [page](wix-dataset/introduction#dataset-pages)'s items when:", - "", - " + The current item is saved in the collection (if necessary).", - " + The next [page of data](wix-dataset/introduction#dataset-pages) is loaded.", - " + Any connected elements have been updated with the new data.", - " + The current item is updated to the first item in the next page.", - "", - "", - " Going to the next [page of data](wix-dataset/introduction#dataset-pages) replaces the current items", - " in any connected elements with the new items that correspond to the", - " next [page of data](wix-dataset/introduction#dataset-pages). Elements that have their own settings for how many items", - " are shown at once, such as tables and galleries, are not affected.", - "", - " Calling `nextPage()` on a write-only dataset causes an error.", - " > **Notes:**", - " > + A dataset needs to load its data before you call its `nextPage()` function. ", - " >", - " > Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call `nextPage()` inside the page’s [`onReady()`]($w.html#onReady) event handler, the dataset might not be ready yet.", - " > ", - "> To call `nextPage()` as soon as possible after a page loads, use the **dataset's** [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady) event handler to ensure that both the page and the dataset have finished loading.", - " > + 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. ", - "> + [setFilter()](wix-dataset/dataset/set-filter)", - "> + [setSort()](wix-dataset/dataset/set-sort)", - "> + [nextPage()](wix-dataset/dataset/next-page)", - "> + [previousPage()](wix-dataset/dataset/previous-page)", - "> + [loadPage()](wix-dataset/dataset/load-page)", - "> + [setPageSize()](wix-dataset/dataset/set-page-size)", - "> + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - "> + [next()](wix-dataset/dataset/next)", - "> + [previous()](wix-dataset/dataset/previous)", - "> + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[previousPage( )](#previousPage)", - "[hasNextPage( )](#hasNextPage)", - "[loadPage( )](#loadPage)" ], - "examples": - [ { "title": "Move to the next page of dataset content", - "body": - [ "$w(\"#myDataset\").nextPage()", - " .then( (items) => {", - " let firstItem = items[0];", - " let fieldValue = firstItem.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );" ], - "extra": - { } }, - { "title": "Move to the next page of dataset content when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").nextPage()", - " .then( (items) => {", - " let firstItem = items[0];", - " let fieldValue = firstItem.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "onAfterSave", - "labels": [], - "nameParams": [], - "params": - [ { "name": "handler", - "type": "wix-dataset.Dataset.AfterSaveHandler", - "doc": "The after save event handler." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 103, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Adds an event handler that runs just after a save.", - "description": - [ "The `onAfterSave()` function allows you to optionally perform actions", - " right after a [`save()`](#save) operation. When you call `save()`, the", - " callback is run after the save has successfully completed.", - "", - " Calling `onAfterSave()` on a read-only dataset causes an error." ], - "links": [], - "examples": - [ { "title": "Register a callback to run after a save", - "body": - [ "$w(\"#myDataset\").onAfterSave( () => {", - " console.log(\"After save\")", - "});" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { "eventType": "afterSave" } }, - { "name": "onBeforeSave", - "labels": [], - "nameParams": [], - "params": - [ { "name": "handler", - "type": "wix-dataset.Dataset.BeforeSaveHandler", - "doc": "The before save event handler." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 70, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Adds an event handler that runs just before a save.", - "description": - [ "The `onBeforeSave()` function allows you to optionally perform actions", - " right before a [`save()`](#save) operation. When you call `save()`, the", - " callback is run before the save operation. Any validity checks on the", - " data are run after the callback runs. If the callback function", - " returns `false`, returns a rejected Promise, or throws an error, the", - " save operation is canceled.", - "", - "> **Notes:** ", - "> + Calling `onBeforeSave()` on a read-only dataset causes an error.", - "> + `onBeforeSave()` runs before any input element validations." ], - "links": [], - "examples": - [ { "title": "Register a callback to run before a save and continue with the save", - "body": - [ "$w(\"#myDataset\").onBeforeSave( () => {", - " console.log(\"Continuing save\");", - " return true;", - "} );" ], - "extra": - { } }, - { "title": "Register a callback to run before a save and cancel the save", - "body": - [ "$w(\"#myDataset\").onBeforeSave( () => {", - " console.log(\"Canceling save\");", - " return false;", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "onCurrentIndexChanged", - "labels": [], - "nameParams": [], - "params": - [ { "name": "handler", - "type": "wix-dataset.Dataset.CurrentIndexChangedHandler", - "doc": "The current index change event handler." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 795, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Adds an event handler that runs when the current index changes.", - "description": - [ "The `onCurrentIndexChanged()` function allows you to optionally perform actions", - " right after the current index changes.", - "", - " Calling `onCurrentIndexChanged()` on a write-only dataset causes an error." ], - "links": [], - "examples": - [ { "title": "Register a callback to run when the current index changes", - "body": - [ "$w(\"#myDataset\").onCurrentIndexChanged( (index) => {", - " let newIndex = index; // 3", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { "eventType": "currentIndexChanged" } }, - { "name": "onError", - "labels": [], - "nameParams": [], - "params": - [ { "name": "handler", - "type": "wix-dataset.Dataset.ErrorHandler", - "doc": "The error handler." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 858, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Adds an event handler that runs when an error occurs.", - "description": - [ "The `onError()` function allows you to perform actions after a dataset", - " operation causes an error such as a field failing validation.", - "", - " The value of the handler's `operation` property is the", - " name of the function that caused the error.", - "", - " For example, the `operation` property could be any of the following:", - "", - " + `\"new\"`", - " + `\"next\"`", - " + `\"save\"`", - " + `\"previous\"`" ], - "links": [], - "examples": - [ { "title": "Register a callback to run when an error occurs", - "body": - [ "$w(\"#myDataset\").onError( (operation, error) => {", - " let errorOp = operation; // \"save\"", - "", - " let errorCode = error.code; // \"DS_VALIDATION_ERROR\"", - "", - " let errorMessage = error.message;", - " // DatasetError: Some of the elements validation failed", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { "eventType": "datasetError" } }, - { "name": "onItemValuesChanged", - "labels": [], - "nameParams": [], - "params": - [ { "name": "handler", - "type": "wix-dataset.Dataset.ItemValuesChangedHandler", - "doc": "The current value changed event handler." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 821, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Adds an event handler that runs when a value of the current item changes.", - "description": - [ "The `onItemValuesChanged()` function allows you to optionally perform actions", - " right after the current item's values change. The item's value changes", - " when a user changes the value in one of the item's connected page elements", - " or you change the value programmatically.", - "", - " Calling `onItemValuesChanged()` on a read-only dataset causes an error." ], - "links": [], - "examples": - [ { "title": "Register a callback to run when the current item's values change", - "body": - [ "$w(\"#myDataset\").onItemValuesChanged( (itemBeforeChange, updatedItem) => {", - " let oldValue = itemBeforeChange.fieldName;", - " let newValue = updatedItem.fieldName;", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { "eventType": "itemValuesChanged" } }, - { "name": "onReady", - "labels": [], - "nameParams": [], - "params": - [ { "name": "handler", - "type": "wix-dataset.Dataset.ReadyHandler", - "doc": "The ready handler." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 892, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Adds an event handler that runs when the dataset is ready.", - "description": - [ "The `onReady()` function allows you to optionally perform actions", - " right after the dataset has loaded its data from the collection and", - " updated all connected page elements with their corresponding values. ", - " > **Notes:** ", - " + The dataset `onReady` event only fires after the page `onReady` event fires.", - " + The `onReady()` function has the same functionality as the [`onReadyAsync()`](#onReadyAsync) function. They differ in that `onReady()` is callback-based, whereas `onReadyAsync()` is promise-based." ], - "links": - [ "[onReadyAsync()](#onReadyAsync)" ], - "examples": - [ { "title": "Register a callback to run after the dataset is ready", - "body": - [ "$w(\"#myDataset\").onReady( () => {", - " console.log(\"The dataset is ready\");", - "} );" ], - "extra": - { } }, - { "title": "Get whether the current item is the last item after the dataset is ready", - "body": - [ "$w.onReady(async () => {", - " //onReady", - " await $w(\"#myDataset\").onReady( () => {", - " let hasNextItem = $w(\"#myDataset\").hasNext(); //true", - " } );", - "", - " //onReadyAsync", - " await $w(\"#myDataset\").onReadyAsync();", - " let hasNextItem = $w(\"#myDataset\").hasNext(); //true", - "} );" ], - "extra": - { "description": "This example demonstrates how both `onReady()` and `onReadyAsync()` functions do the same thing." } } ], - "extra": - { } }, - "extra": - { "eventType": "datasetReady" } }, - { "name": "onReadyAsync", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the dataset is loaded." }, - "locations": - [ { "lineno": 1439, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "The `onReadyAsync()` function returns a Promise that resolves when a dataset is ready.", - "description": - [ "Similar to the [`onReady()`](#onReady) function, the `onReadyAsync()` function allows you ", - " to optionally perform actions once a dataset is ready. A dataset is ready after it has loaded its data ", - " from the collection and updated all connected page elements with their corresponding values. ", - " `onReadyAsync()` differs from `onReady()` in that `onReadyAsync()` is promise-based, ", - " whereas `onReady()` is based on callback functions." ], - "links": - [ "[onReady()](#onReady)" ], - "examples": - [ { "title": "Get the dataset's current item after the dataset is ready", - "body": - [ "$w.onReady(async () => {", - " await $w('#myDataset').onReadyAsync();", - " let currentItem = $w('#myDataset').getCurrentItem();", - " console.log(currentItem);", - "} );", - "", - "/* ", - " * {", - " * \"_id\": \"fcec780a-3e37-4b64-8a66-37c552c53f99\",", - " * \"_owner\": \"f6c0f9c3-a62d-7e9f-g58d-943829af244d9\",", - " * \"_createdDate\": \"2017-05-01T17:19:03.823Z\",", - " * \"_updatedDate\": \"2017-05-01T17:19:10.477Z\",", - " * \"title\": \"Dr. \",", - " * \"name\": \"John\",", - " * \"age\": \"50\"", - " * }", - " */" ], - "extra": - { } }, - { "title": "Get and add the total number of items from multiple datasets after they are ready", - "body": - [ "$w.onReady(async () => {", - " const promise1 = $w('#myDataset1').onReadyAsync();", - " const promise2 = $w('#myDataset2').onReadyAsync();", - "", - " await Promise.all([promise1, promise2]);", - " const combinedTotal = $w('#myDataset1').getTotalCount() + $w('#myDataset2').getTotalCount(); ", - " console.log(`Combined total items in both datasets: ${combinedTotal}`); //8", - "} );" ], - "extra": - { "description": "This example gets the number of items from multiple datasets. It uses the `Promise.all()` function, \nwhich takes an array of promises returned by 2 `onReadyAsync()` functions, and returns them as a single \nPromise. This Promise is only resolved once both `onReadyAsync` promises are are resolved. \nOnce fulfilled, the total number of items from each dataset is retrieved." } }, - { "title": "Get the total number of items after the dataset is ready", - "body": - [ "$w.onReady(async () => {", - " //onReady", - " await $w(\"#myDataset\").onReady( () => {", - " let onReadyTotalCount = $w(\"#myDataset\").getTotalCount(); //4", - " } );", - "", - " //onReadyAsync", - " await $w(\"#myDataset\").onReadyAsync();", - " let onReadyAsyncTotalCount = $w(\"#myDataset\").getTotalCount(); //4", - "} );", - "" ], - "extra": - { "description": "This example demonstrates how both `onReady()` and `onReadyAsync()` functions do the same thing." } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "previous", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "Object" ] }, - "doc": "Fulfilled - The previous item in the dataset.\nRejected - An error message." }, - "locations": - [ { "lineno": 507, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Saves the current item and moves to the previous item.", - "description": - [ "The `previous()` function returns a Promise that is resolved to the previous item", - " when:", - "", - " + The current item is saved in the collection (if necessary).", - " + Any connected page elements have been updated with the new current item’s values.", - "", - "", - " Calling `previous()` on a write-only dataset causes the", - " Promise to reject.", - "", - " If the dataset is read-write, the current item is saved even if there is", - " no previous item.", - "", - " > **Notes:**", - " > + A dataset needs to load its data before you call its `previous()` function. ", - " >", - " > Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call `previous()` inside the page’s [`onReady()`]($w.html#onReady) event handler, the dataset might not be ready yet.", - " > ", - "> To call `previous()` as soon as possible after a page loads, use the **dataset's** [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady) event handler to ensure that both the page and the dataset have finished loading.", - " > + 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. ", - "> + [setFilter()](wix-dataset/dataset/set-filter)", - "> + [setSort()](wix-dataset/dataset/set-sort)", - "> + [nextPage()](wix-dataset/dataset/next-page)", - "> + [previousPage()](wix-dataset/dataset/previous-page)", - "> + [loadPage()](wix-dataset/dataset/load-page)", - "> + [setPageSize()](wix-dataset/dataset/set-page-size)", - "> + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - "> + [next()](wix-dataset/dataset/next)", - "> + [previous()](wix-dataset/dataset/previous)", - "> + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[next( )](#next)", - "[hasPrevious( )](#hasPrevious)" ], - "examples": - [ { "title": "Move to the previous item", - "body": - [ "$w(\"#myDataset\").previous()", - " .then( (item) => {", - " let fieldValue = item.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );" ], - "extra": - { } }, - { "title": "Move to the previous item when page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").previous()", - " .then( (item) => {", - " let fieldValue = item.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "previousPage", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ { "name": "Array", - "typeParams": - [ "Object" ] } ] }, - "doc": "Fulfilled - When the previous page of data has been loaded and any connected repeaters have been updated.\nRejected - An error message." }, - "locations": - [ { "lineno": 1170, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Moves to the previous page of data.", - "description": - [ "The `previousPage()` function returns a Promise that is resolved to", - " an array of the previous [page](wix-dataset/introduction#dataset-pages)'s items when:", - "", - " + The current item is saved in the collection (if necessary).", - " + The previous [page of data](wix-dataset/introduction#dataset-pages) is loaded.", - " + Any connected elements have been updated with the new data.", - " + The current item is updated to the first item in the previous page.", - "", - "", - " Going to the previous [page of data](wix-dataset/introduction#dataset-pages) replaces the current items", - " in any connected elements with the new items that correspond to the", - " previous [page of data](wix-dataset/introduction#dataset-pages). Elements that have their own settings for how many items", - " are shown at once, such as tables and galleries, are not affected.", - "", - " Calling `previousPage()` on a write-only dataset causes an error.", - " > **Notes:**", - " >", - " > + A dataset needs to load its data before you call its `previousPage()` function.", - " >", - " > Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call `previousPage()` inside the page’s [`onReady()`]($w.html#onReady) event handler, the dataset might not be ready yet.", - " >", - " > To call `previousPage()` as soon as possible after a page loads, use the **dataset's** [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady) event handler to ensure that both the page and the dataset have finished loading.", - " > + 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. ", - " > + [setFilter()](wix-dataset/dataset/set-filter)", - " > + [setSort()](wix-dataset/dataset/set-sort)", - " > + [nextPage()](wix-dataset/dataset/next-page)", - " > + [previousPage()](wix-dataset/dataset/previous-page)", - " > + [loadPage()](wix-dataset/dataset/load-page)", - " > + [setPageSize()](wix-dataset/dataset/set-page-size)", - " > + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - " > + [next()](wix-dataset/dataset/next)", - " > + [previous()](wix-dataset/dataset/previous)", - " > + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[nextPage( )](#previousPage)", - "[hasPreviousPage( )](#hasNextPage)", - "[loadPage( )](#loadPage)" ], - "examples": - [ { "title": "Move to the previous page of dataset content", - "body": - [ "$w(\"#myDataset\").previousPage()", - " .then( (items) => {", - " let firstItem = items[0];", - " let fieldValue = firstItem.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );" ], - "extra": - { } }, - { "title": "Move to the previous page of dataset content when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").previousPage()", - " .then( (items) => {", - " let firstItem = items[0];", - " let fieldValue = firstItem.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "refresh", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the refresh is finished.\nRejected - An error message." }, - "locations": - [ { "lineno": 766, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Refetches the contents of the dataset from the collection.", - "description": - [ "The `refresh()` function returns a Promise that is resolved", - " when:", - "", - " + The dataset's contents are refetched from the collection, discarding", - " current edits.", - " + Any connected page elements have been updated with the values from", - " the collection (read & write mode) or blank values (write-only mode).", - "", - "", - " Refreshing the dataset sets the current item back to the first item in", - " the dataset regardless of what the current item was before refreshing.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `refresh()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `refresh()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `refresh()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[revert( )](#revert)", - "[save( )](#save)" ], - "examples": - [ { "title": "Refresh the dataset contents", - "body": - [ "$w(\"#myDataset\").refresh()", - " .then( () => {", - " console.log(\"Done refreshing the dataset\");", - " } );" ], - "extra": - { } }, - { "title": "Refresh the dataset contents when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").refresh()", - " .then( () => {", - " console.log(\"Done refreshing the dataset\");", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "remove", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the current item has been removed from the collection." }, - "locations": - [ { "lineno": 692, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Removes the current item.", - "description": - [ "The `remove()` function returns a Promise that is resolved", - " when:", - "", - " + The current item is deleted in the collection.", - " + Any connected page elements have been updated with the next item’s", - " values if there is a next item, or the previous item's values if the", - " removed item was the last item.", - "", - "", - " Calling `remove()` on a write-only or read-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `remove()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `remove()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `remove()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[revert( )](#revert)", - "[refresh( )](#refresh)" ], - "examples": - [ { "title": "Remove the current item", - "body": - [ "$w(\"#myDataset\").remove()", - " .then( () => {", - " console.log(\"Done removing current item\");", - " } );" ], - "extra": - { } }, - { "title": "Remove the current item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").remove()", - " .then( () => {", - " console.log(\"Done removing current item\");", - " } );", - " ", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "revert", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the item has been reverted to its saved state.\nRejected - An error message." }, - "locations": - [ { "lineno": 729, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Reverts the current item to its saved value.", - "description": - [ "The `revert()` function returns a Promise that is resolved", - " when:", - "", - " + The current item is reverted to its saved state in the collection.", - " + Any connected page elements have been updated with the current item’s", - " old values (read & write mode) or blank values (write-only mode).", - "", - "", - " Calling `revert()` on a read-only dataset causes the Promise to reject.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `revert()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `revert()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `revert()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[refresh( )](#refresh)", - "[save( )](#save)" ], - "examples": - [ { "title": "Revert the current item", - "body": - [ "$w(\"#myDataset\").revert()", - " .then( () => {", - " console.log(\"Done reverting the item\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );" ], - "extra": - { } }, - { "title": "Revert the current item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").revert()", - " .then( () => {", - " console.log(\"Done reverting the item\");", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "save", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "Object" ] }, - "doc": "Fulfilled - The saved item.\nRejected - An error message." }, - "locations": - [ { "lineno": 126, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Saves the current item.", - "description": - [ "The `save()` function returns a Promise that is resolved to the saved item", - " when:", - "", - " + The current item is saved in the collection.", - " + Any connected page elements have been updated with the current item’s new", - " values (read & write mode) or a new blank item (write-only mode).", - "", - "", - " Calling `save()` on a read-only dataset causes the Promise to reject.", - "", - " > **Notes:**", - " > + A dataset needs to load its data before you call its `save()` function. ", - " >", - " > Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call `save()` inside the page’s [`onReady()`]($w.html#onReady) event handler, the dataset might not be ready yet.", - " > ", - "> To call `save()` as soon as possible after a page loads, use the **dataset's** [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady) event handler to ensure that both the page and the dataset have finished loading.", - " > + 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. ", - "> + [setFilter()](wix-dataset/dataset/set-filter)", - "> + [setSort()](wix-dataset/dataset/set-sort)", - "> + [nextPage()](wix-dataset/dataset/next-page)", - "> + [previousPage()](wix-dataset/dataset/previous-page)", - "> + [loadPage()](wix-dataset/dataset/load-page)", - "> + [setPageSize()](wix-dataset/dataset/set-page-size)", - "> + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - "> + [next()](wix-dataset/dataset/next)", - "> + [previous()](wix-dataset/dataset/previous)", - "> + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[revert( )](#revert)", - "[refresh( )](#refresh)" ], - "examples": - [ { "title": "Save the current item", - "body": - [ "$w(\"#myDataset\").save()", - " .then( (item) => {", - " let fieldValue = item.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );" ], - "extra": - { } }, - { "title": "Save the current item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").save()", - " .then( (item) => {", - " let fieldValue = item.fieldName;", - " } )", - " .catch( (err) => {", - " let errMsg = err;", - " } );", - "", - " } );", - "", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "setCurrentItemIndex", - "labels": [], - "nameParams": [], - "params": - [ { "name": "index", - "type": "number", - "doc": "The index of the item to set as the current item." } ], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the item with the given index is set to the current item.\nRejected - Rejects if the item with the given index does not exist or it cannot be set to the current item." }, - "locations": - [ { "lineno": 342, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Sets the current item by index.", - "description": - [ "The `setCurrentItemIndex()` function returns a Promise that is resolved when:", - "", - " + The current item has been saved in the collection (if necessary).", - " + The current item has been updated to be the item with the given index.", - " + Any connected page elements have been updated with the new current item’s values.", - "", - "", - " Calling `setCurrentItemIndex()` on a write-only dataset causes the", - " Promise to reject.", - "", - " > **Notes:**", - " > + A dataset needs to load its data before you call its `setCurrentItemIndex()` function. ", - " >", - " > Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call `setCurrentItemIndex()` inside the page’s [`onReady()`]($w.html#onReady) event handler, the dataset might not be ready yet.", - " > ", - "> To call `setCurrentItemIndex()` as soon as possible after a page loads, use the **dataset's** [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady) event handler to ensure that both the page and the dataset have finished loading.", - " > + 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. ", - "> + [setFilter()](wix-dataset/dataset/set-filter)", - "> + [setSort()](wix-dataset/dataset/set-sort)", - "> + [nextPage()](wix-dataset/dataset/next-page)", - "> + [previousPage()](wix-dataset/dataset/previous-page)", - "> + [loadPage()](wix-dataset/dataset/load-page)", - "> + [setPageSize()](wix-dataset/dataset/set-page-size)", - "> + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - "> + [next()](wix-dataset/dataset/next)", - "> + [previous()](wix-dataset/dataset/previous)", - "> + [save()](wix-dataset/dataset/save)", - "", - "> + `setCurrentItemIndex()` saves the current item even if the requested item is same as the current item." ], - "links": - [ "[getCurrentItemIndex( )](#getCurrentItemIndex)", - "[getCurrentItem( )](#getCurrentItem)" ], - "examples": - [ { "title": "Set the dataset's current item", - "body": - [ "$w(\"#myDataset\").setCurrentItemIndex(3);" ], - "extra": - { } }, - { "title": "Set the dataset's current item when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").setCurrentItemIndex(3)", - " .then( () => {", - " console.log(\"Done setting current item\");", - " } );", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "setFieldValue", - "labels": [], - "nameParams": [], - "params": - [ { "name": "fieldKey", - "type": "string", - "doc": "The field ID of the field to update." }, - { "name": "value", - "type": "*", - "doc": "The new value." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 390, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Updates the value of a field in the current item.", - "description": - [ "The `setFieldValue` function sets the value of a field in the current item.", - " Setting a field value fires an `onItemValuesChanged` event when the page", - " elements connected to the field have been updated with the new value.", - "", - " Setting the value of a field in a dataset item does not immediately set", - " that value in the collection that the dataset is connected to. You still", - " need to call the dataset `save()` function or any other function that", - " performs a save to have the new value reflecting in the collection.", - "", - " Calling `setFieldValue()` on a read-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `setFieldValue()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `setFieldValue()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `setFieldValue()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[setFieldValues( )](#setFieldValues)" ], - "examples": - [ { "title": "Set a field's value", - "body": - [ "$w(\"#myDataset\").setFieldValue(\"title\", \"New Title\");" ], - "extra": - { } }, - { "title": "Set a field's value and save the item to the connected collection", - "body": - [ "$w(\"#myDataset\").setFieldValue(\"title\", \"New Title\");", - "$w(\"#myDataset\").save();" ], - "extra": - { } }, - { "title": "Set a field's value when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").setFieldValue(\"title\", \"New Title\");", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "setFieldValues", - "labels": [], - "nameParams": [], - "params": - [ { "name": "fieldValues", - "type": "Object", - "doc": "A map of field IDs to new values." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 429, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Updates the values of a set of fields in the current item.", - "description": - [ "The `setFieldValues` function sets the value of a set of fields in the current item.", - " Setting the field values fires one `onItemValuesChanged` event when the page", - " elements connected to the fields have been updated with the new values.", - "", - " Calling `setFieldValues()` on a read-only dataset causes an error.", - "", - " > **Note:**", - " >", - " > A dataset needs to load its data before you call its `setFieldValues()` function.", - " > Usually a dataset finishes loading a short time after the page it is on finishes", - " > loading. So if you call `setFieldValues()` inside the page’s [`onReady()`]($w.html#onReady)", - " > event handler, the dataset might not be ready yet.", - " >", - " > To call `setFieldValues()` as soon as possible after a page loads, use the **dataset's**", - " > [`onReady()`](#onReady) function inside the **page’s** [`onReady()`]($w.html#onReady)", - " > event handler to ensure that both the page and the dataset have finished loading." ], - "links": - [ "[setFieldValue( )](#setFieldValue)" ], - "examples": - [ { "title": "Set several fields' values", - "body": - [ "$w(\"#myDataset\").setFieldValues( {", - " \"title\": \"New Title\",", - " \"name\": \"New Name\"", - "} );" ], - "extra": - { } }, - { "title": "Set several fields' values when the page loads", - "body": - [ "$w.onReady( () => {", - " $w(\"#myDataset\").onReady( () => {", - " $w(\"#myDataset\").setFieldValues( {", - " \"title\": \"New Title\",", - " \"name\": \"New Name\"", - " } );", - "", - " } );", - " ", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "setFilter", - "labels": [], - "nameParams": [], - "params": - [ { "name": "filter", - "type": "wix-data.WixDataFilter", - "doc": "A wix-data filter object." } ], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the filter has been set.\nRejected - An error object." }, - "locations": - [ { "lineno": 998, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Sets the dataset filter.", - "description": - [ "The `setFilter()` function filters out items that don't match the filter", - " criteria.", - "", - " The `WixDataFilter` object is created by calling the [`filter()`](wix-data.html#filter)", - " function on `wixData` and chaining one or more of the following Wix Data", - " filter functions.", - "", - " + [and](wix-data.WixDataFilter.html#and): See note below.", - " + [ascending](wix-data.WixDataSort.html#ascending)", - " + [between](wix-data.WixDataFilter.html#between)", - " + [contains](wix-data.WixDataFilter.html#contains)", - " + [descending](wix-data.WixDataSort.html#descending)", - " + [endsWith](wix-data.WixDataFilter.html#endsWith)", - " + [eq](wix-data.WixDataFilter.html#eq)", - " + [ge](wix-data.WixDataFilter.html#ge)", - " + [gt](wix-data.WixDataFilter.html#gt)", - " + [hasAll](wix-data.WixDataFilter.html#hasAll)", - " + [hasSome](wix-data.WixDataFilter.html#hasSome)", - " + [isEmpty](wix-data.WixDataFilter.html#isEmpty)", - " + [isNotEmpty](wix-data.WixDataFilter.html#isNotEmpty)", - " + [le](wix-data.WixDataFilter.html#le)", - " + [lt](wix-data.WixDataFilter.html#lt)", - " + [ne](wix-data.WixDataFilter.html#ne)", - " + [not](wix-data.WixDataFilter.html#not): See note below.", - " + [or](wix-data.WixDataFilter.html#or): See note below.", - " + [startsWith](wix-data.WixDataFilter.html#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()`](wix-data.html#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](wix-data.WixDataQuery.html#and), [not](wix-data.WixDataQuery.html#not), or [or](wix-data.WixDataQuery.html#or) functions, be sure to pass them a `WixDataFilter` object created by calling the [`filter()`](wix-data.html#filter) function and not a `WixDataQuery` 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. ", - "> + [setFilter()](wix-dataset/dataset/set-filter)", - "> + [setSort()](wix-dataset/dataset/set-sort)", - "> + [nextPage()](wix-dataset/dataset/next-page)", - "> + [previousPage()](wix-dataset/dataset/previous-page)", - "> + [loadPage()](wix-dataset/dataset/load-page)", - "> + [setPageSize()](wix-dataset/dataset/set-page-size)", - "> + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - "> + [next()](wix-dataset/dataset/next)", - "> + [previous()](wix-dataset/dataset/previous)", - "> + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[setSort( )](#setSort)" ], - "examples": - [ { "title": "Set a dataset's filter", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "$w(\"#myDataset\").setFilter( wixData.filter()", - " .startsWith(\"lastName\", \"D\")", - " .ge(\"age\", \"21\")", - ");", - "" ], - "extra": - { "description": "This example filters a dataset to only have items where the `lastname`\n field starts with \"D\" and the `age` field is greater or equal to 21." } }, - { "title": "Build and set a dataset's filter", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "function filter(low, high) {", - " let filter = wixData.filter();", - "", - " if(low) {", - " filter = filter.ge(\"price\", low);", - " }", - "", - " if(high) {", - " filter = filter.le(\"length\", high);", - " }", - "", - " $w(\"#myDataset\").setFilter(filter);", - "}", - "" ], - "extra": - { "description": "This example builds a filter based on certain conditions. It then uses the\n built filter to filter a dataset." } }, - { "title": "Set a dataset's filter", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "$w(\"#myDataset\").setFilter( wixData.filter()", - " .startsWith(\"lastName\", \"D\")", - " .ge(\"age\", \"21\")", - ")", - ".then( () => {", - " console.log(\"Dataset is now filtered\");", - "} )", - ".catch( (err) => {", - " console.log(err);", - "} );" ], - "extra": - { } }, - { "title": "Clear a dataset's filters", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "$w(\"#myDataset\").setFilter( wixData.filter() );" ], - "extra": - { } }, - { "title": "Set a dataset's filter with an or condition", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "$w(\"#myDataset\").setFilter( wixData.filter()", - " .startsWith(\"lastName\", \"D\")", - " .or(", - " wixData.filter()", - " .ge(\"age\", \"21\")", - " )", - ")", - ".then( () => {", - " console.log(\"Dataset is now filtered\");", - "} )", - ".catch( (err) => {", - " console.log(err);", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "setPageSize", - "labels": [], - "nameParams": [], - "params": - [ { "name": "pageSize", - "type": "number", - "doc": "The new page size." } ], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the page size has been set.\nRejected - An error object." }, - "locations": - [ { "lineno": 1397, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Sets the dataset's page size.", - "description": - [ "The `setPageSize()` function returns a Promise that is resolved when:", - "", - " + The current item is saved in the collection (if necessary).", - " + The dataset's [page](wix-dataset/introduction#dataset-pages) size is reset.", - " + The dataset is refreshed, and any connected elements have been updated.", - "", - "", - " Because setting the [page](wix-dataset/introduction#dataset-pages) size refreshes the dataset, the dataset's", - " current item is reset to the first item in the dataset.", - "", - " Calling `setPageSize()` on a write-only dataset causes an error.", - "", - " > **Note:** ", - " > 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. ", - " > + [setFilter()](wix-dataset/dataset/set-filter)", - " > + [setSort()](wix-dataset/dataset/set-sort)", - " > + [nextPage()](wix-dataset/dataset/next-page)", - " > + [previousPage()](wix-dataset/dataset/previous-page)", - " > + [loadPage()](wix-dataset/dataset/load-page)", - " > + [setPageSize()](wix-dataset/dataset/set-page-size)", - " > + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - " > + [next()](wix-dataset/dataset/next)", - " > + [previous()](wix-dataset/dataset/previous)", - " > + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[getPageSize( )](#getPageSize)" ], - "examples": - [ { "title": "Set a dataset's page size", - "body": - [ "$w(\"#myDataset\").setPageSize(6)", - " .then( () => {", - " console.log(\"Page size set.\");", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "setSort", - "labels": [], - "nameParams": [], - "params": - [ { "name": "sort", - "type": "wix-data.WixDataSort", - "doc": "A wix-data sort object." } ], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "void" ] }, - "doc": "Fulfilled - When the sort has been set.\nRejected - An error message." }, - "locations": - [ { "lineno": 939, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "Sets the dataset sort order.", - "description": - [ "The `setSort` function sorts the items in the dataset.", - "", - " The `WixDataSort` object is created by calling the [`sort()`](wix-data.html#sort)", - " function on `wixData` and chaining one or more of the following Wix Data", - " sort functions.", - "", - " + [ascending](wix-data.WixDataQuery.html#ascending)", - " + [descending](wix-data.WixDataQuery.html#descending)", - "", - "", - " Setting a dataset's sort overrides existing sorts that were previously", - " set using the `setSort()` function or using the Dataset Settings", - " panel in the Editor.", - "", - " To clear a dataset's current sort, call `setSort()` and pass it an", - " empty sort. You create an empty sort by calling the [`sort()`](wix-data.html#sort)", - " function without chaining any of the additional sort functions mentioned above.", - "", - " Calling `setSort()` on a write-only dataset causes an error.", - "", - " You will need to import `wix-data` to create a `WixDataSort` object.", - " > **Note:** ", - " > 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. ", - " > + [setFilter()](wix-dataset/dataset/set-filter)", - " > + [setSort()](wix-dataset/dataset/set-sort)", - " > + [nextPage()](wix-dataset/dataset/next-page)", - " > + [previousPage()](wix-dataset/dataset/previous-page)", - " > + [loadPage()](wix-dataset/dataset/load-page)", - " > + [setPageSize()](wix-dataset/dataset/set-page-size)", - " > + [setCurrentItemIndex()](wix-dataset/dataset/set-current-item-index)", - " > + [next()](wix-dataset/dataset/next)", - " > + [previous()](wix-dataset/dataset/previous)", - " > + [save()](wix-dataset/dataset/save)" ], - "links": - [ "[setFilter( )](#setFilter)" ], - "examples": - [ { "title": "Set a dataset's sort", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "$w(\"#myDataset\").setSort( wixData.sort()", - " .ascending(\"lastName\")", - " .descending(\"age\")", - ");", - "" ], - "extra": - { "description": "This example sorts a dataset by `lastname` field in ascending order and\n when more than one item has the same `lastname` value they are sorted\n by the `age` field in descending order." } }, - { "title": "Build and set a dataset's sort", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "function sort(name, dob) {", - " let sort = wixData.sort();", - "", - " if(name === \"desc\") {", - " sort = sort.descending(\"name\");", - " }", - " else {", - " sort = sort.ascending(\"name\");", - " }", - "", - " if(dob === \"desc\") {", - " sort = sort.descending(\"dob\");", - " }", - " else {", - " sort = sort.ascending(\"dob\");", - " }", - "", - " $w(\"#myDataset\").setSort(sort);", - "}", - "" ], - "extra": - { "description": "This example builds a sort based on certain conditions. It then uses the\n built sort to sort a dataset." } }, - { "title": "Set a dataset's sort", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "$w(\"#myDataset\").setSort( wixData.sort()", - " .ascending(\"lastName\")", - " .descending(\"age\")", - ")", - ".then( () => {", - " console.log(\"Dataset is now sorted\");", - "} )", - ".catch( (err) => {", - " console.log(err);", - "} );" ], - "extra": - { } }, - { "title": "Clear a dataset's sorts", - "body": - [ "import wixData from 'wix-data';", - "", - "// ...", - "", - "$w(\"#myDataset\").setSort( wixData.sort() );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } } ], - "callbacks": - [ { "name": "AfterSaveHandler", - "labels": [], - "nameParams": [], - "params": - [ { "name": "itemBeforeSave", - "type": "Object", - "doc": "The item before being saved." }, - { "name": "itemAfterSave", - "type": "Object", - "doc": "The item after being saved." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 94, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "An after save event handler.", - "links": [], - "examples": [], - "extra": - { } }, - "extra": - { } }, - { "name": "BeforeSaveHandler", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": - [ { "name": "Promise", - "typeParams": - [ "boolean" ] }, - "boolean" ] }, - "locations": - [ { "lineno": 63, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "A before save event handler.", - "links": [], - "examples": [], - "extra": - { } }, - "extra": - { } }, - { "name": "CurrentIndexChangedHandler", - "labels": [], - "nameParams": [], - "params": - [ { "name": "index", - "type": "number", - "doc": "The new index." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 788, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "A current item index change event handler.", - "links": [], - "examples": [], - "extra": - { } }, - "extra": - { } }, - { "name": "ErrorHandler", - "labels": [], - "nameParams": [], - "params": - [ { "name": "operation", - "type": "string", - "doc": "The operation during which the error occurred." }, - { "name": "error", - "type": "wix-dataset.Dataset.DatasetError", - "doc": "The error that occurred." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 850, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "An error event handler.", - "links": [], - "examples": [], - "extra": - { } }, - "extra": - { } }, - { "name": "ItemValuesChangedHandler", - "labels": [], - "nameParams": [], - "params": - [ { "name": "itemBeforeChange", - "type": "Object", - "doc": "The item before the change." }, - { "name": "updatedItem", - "type": "Object", - "doc": "The updated item." } ], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 813, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "A current item value change event handler.", - "links": [], - "examples": [], - "extra": - { } }, - "extra": - { } }, - { "name": "ReadyHandler", - "labels": [], - "nameParams": [], - "params": [], - "ret": - { "type": "void" }, - "locations": - [ { "lineno": 886, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "A dataset ready event handler.", - "links": [], - "examples": [], - "extra": - { } }, - "extra": - { } } ], - "messages": - [ { "name": "DatasetError", - "locations": - [ { "lineno": 863, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "An object representing a dataset error.", - "links": [], - "examples": - [ { "title": "Register a callback to run when an error occurs", - "body": - [ "$w(\"#myDataset\").onError( (operation, error) => {", - " let errorOp = operation; // \"save\"", - "", - " let errorCode = error.code; // \"DS_VALIDATION_ERROR\"", - "", - " let errorMessage = error.message;", - " // DatasetError: Some of the elements validation failed", - "} );" ], - "extra": - { } } ], - "extra": - { } }, - "members": - [ { "name": "code", - "type": "string", - "doc": "Error code." }, - { "name": "message", - "type": "string", - "doc": "Error message." } ], - "extra": - { }, - "labels": [] }, - { "name": "GetItemsResult", - "locations": - [ { "lineno": 171, - "filename": "datasetApi.js" } ], - "docs": - { "summary": "An object used by the `getItems()` function that contains the items retrieved and the total number of items in the dataset that match its filter criteria", - "links": - [ "[getItems( )](#getItems)" ], - "examples": - [ { "title": "Get items from the dataset", - "body": - [ "$w(\"#myDataset\").getItems(3, 2)", - " .then( (result) => {", - " let items = result.items;", - " let totalCount = result.totalCount;", - " let offset = result.offset;", - " } )", - " .catch( (err) => {", - " let errMsg = err.message;", - " let errCode = err.code;", - " } );" ], - "extra": - { } } ], - "extra": - { } }, - "members": - [ { "name": "items", - "type": - { "name": "Array", - "typeParams": - [ "Object" ] }, - "doc": "List of items objects where key:value pairs are the field IDs and field values of the retrieved items, including all hidden fields." }, - { "name": "totalCount", - "type": "number", - "doc": "The number of items in the dataset that match its filter criteria." }, - { "name": "offset", - "type": "number", - "doc": "The index in the dataset of the first item in the items property." } ], - "extra": - { }, - "labels": [] } ], - "extra": - { } } \ No newline at end of file diff --git a/dbsm-viewer-app/wix-dataset/DynamicDataset.service.json b/dbsm-viewer-app/wix-dataset/DynamicDataset.service.json deleted file mode 100644 index bd7ec63ac0..0000000000 --- a/dbsm-viewer-app/wix-dataset/DynamicDataset.service.json +++ /dev/null @@ -1,165 +0,0 @@ -{ "name": "DynamicDataset", - "memberOf": "wix-dataset", - "mixes": - [ "wix-dataset.Dataset" ], - "labels": - [ "changed" ], - "location": - { "lineno": 1, - "filename": "routerDatasetApi.js" }, - "docs": - { "summary": "A [dataset](wix-dataset.html) connects page elements on a dynamic page to a set of items in a data collection.\n\n>**Note:** It is not possible to connect page elements on a dynamic page to an item in a [single item collection](https://support.wix.com/en/article/about-collections-with-a-single-item).", - "links": [], - "examples": [], - "extra": - { } }, - "properties": [], - "operations": - [ { "name": "getNextDynamicPage", - "labels": - [ "changed" ], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "string" ] }, - "doc": "Fulfilled - The URL of the next dynamic page, or `null` if there is no next page." }, - "locations": - [ { "lineno": 11, - "filename": "routerDatasetApi.js" } ], - "docs": - { "summary": "Gets the next dynamic page URL.", - "description": - [ "The `getNextDynamicPage()` function can only be called on a dynamic page", - " dataset.", - "", - " The function returns a Promise that is resolved to the relative URL of the", - " next dynamic page or `null` if there is no next page.", - "", - " The next page is determined by the [lexicographical order](https://en.wikipedia.org/wiki/Lexicographical_order)", - " of the dynamic page relative URLs. You can see all of the relative URLs for", - " a dynamic page by viewing the collection connected to the page.", - "", - " URLs for items that do not match the dataset's filters are not returned.", - "", - " For example, consider the following situation:", - "", - " + You have a collection of employees that contains a boolean field named **Active**.", - " + Your dynamic page datset is filtered to only show employees where **Active** is **true**.", - " + Some of your dynamic page URLs include:", - " + employees/Alice", - " + employees/Bob", - " + employees/Cathy", - "", - "", - " If Bob is not an active employee, when you call `getNextDynamicPage()`", - " from Alice's page, the returned Promise will resolve to `\"employees/Cathy\"`.", - "", - " Pass the returned URL to the [`to()`](https://dev.wix.com/docs/velo/api-reference/wix-location-frontend/to) function to", - " navigate to the next dynamic page." ], - "links": - [ "[getPreviousDynamicPage( )](#getPreviousDynamicPage)" ], - "examples": - [ { "title": "Get the URL of the next dynamic page", - "body": - [ "$w(\"#myDataset\").getNextDynamicPage()", - " .then( (next) => {", - " // do something with next page URL", - " // URL looks like: \"/myCollection/Value\"", - " } );" ], - "extra": - { } }, - { "title": "Navigate to the next dynamic page", - "body": - [ "import wixLocationFrontend from 'wix-location-frontend';", - "", - "$w(\"#myDataset\").getNextDynamicPage()", - " .then( (next) => {", - " if(next){", - " wixLocationFrontend.to(next);", - " }", - " } );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } }, - { "name": "getPreviousDynamicPage", - "labels": - [ "changed" ], - "nameParams": [], - "params": [], - "ret": - { "type": - { "name": "Promise", - "typeParams": - [ "string" ] }, - "doc": "Fulfilled - The URL of the previous dynamic page, or `null` if there is no previous page." }, - "locations": - [ { "lineno": 53, - "filename": "routerDatasetApi.js" } ], - "docs": - { "summary": "Gets the previous dynamic page URL.", - "description": - [ "The `getPreviousDynamicPage()` function can only be called on a dynamic page", - " dataset.", - "", - " The function returns a Promise that is resolved to the relative URL of the", - " previous dynamic page or `null` if there is no previous page.", - "", - " The previous page is determined by the [lexicographical order](https://en.wikipedia.org/wiki/Lexicographical_order)", - " of the dynamic page relative URLs. You can see all of the relative URLs for", - " a dynamic page by viewing the collection connected to the page.", - "", - " URLs for items that do not match the dataset's filters are not returned.", - "", - " For example, consider the following situation:", - "", - " + You have a collection of employees that contains a boolean field named **Active**.", - " + Your dynamic page datset is filtered to only show employees where **Active** is **true**.", - " + Some of your dynamic page URLs include:", - " + employees/Alice", - " + employees/Bob", - " + employees/Cathy", - "", - "", - " If Bob is not an active employee, when you call `getPreviousDynamicPage()`", - " from Cathy's page, the returned Promise will resolve to `\"employees/Alice\"`.", - "", - " Pass the returned URL to the [`to()`](https://dev.wix.com/docs/velo/api-reference/wix-location-frontend/to) function to", - " navigate to the previous dynamic page." ], - "links": - [ "[getNextDynamicPage( )](#getNextDynamicPage)" ], - "examples": - [ { "title": "Get the URL of the previous dynamic page", - "body": - [ "$w(\"#myDataset\").getPreviousDynamicPage()", - " .then( (prev) => {", - " // do something with previous page URL", - " // URL looks like: \"/myCollection/Value\"", - " } );" ], - "extra": - { } }, - { "title": "Navigate to the previous dynamic page", - "body": - [ "import wixLocationFrontend from 'wix-location-frontend';", - "", - "$w(\"#myDataset\").getPreviousDynamicPage()", - " .then( (prev) => {", - " if(prev){", - " wixLocationFrontend.to(prev);", - " }", - " } );" ], - "extra": - { } } ], - "extra": - { } }, - "extra": - { } } ], - "callbacks": [], - "messages": [], - "extra": - { } } \ No newline at end of file