-
How do I Delete a column in the Sandbox Database?
-
Why am I not able to view my Live Database when I click on the icon – even after I synced the data to the live database?
-
My buttons do not go to previous and next database item. I’ve used the tutorial to guide me through the right steps and still nothing happens when I click the buttons in preview mode.
-
Currently, you cannot delete a column in a database collection. We are working on this. In the meantime, you can rename the field (so you can use the name again) and hide the field you don’t want.
-
Have you published your site since you created the collection? The live collection is not created until you publish the site.
-
Can you give some more details? Which tutorial did you use as a guide? How is your page built? Is it a regular page or a dynamic page?
denikatw, you can now delete a field from your database.
Yay! That’s exciting news… About the buttons not working, see the arrows in the botton right corner, (not the “back to inventory” arrows) I wanted to program them so they can go to next database item and previous database item when clicked. I followed the tutorial but they still don’t work. Hopefully I made it more clear.
denikatw can you please provide a link to your site, to this page.
This is a dynamic page for an item. Both buttons are disabled because the information of the order is in the source page. We’d need to work on a solution for having such buttons in a dynamic page. Meantime I’ll try to find you a solution using code. I’ll let you know.
Just like Denikatw I also thought linking the buttons to go to Next and/or Previous Dataset Items would bring it to the next/previous database entry. I think the wording should be a bit different. Would also be interested in knowing the code for the arrow solutions
Thank you Shay! You are awesome!
denikatw & Jason, let’s try the next code sample.
Go to your gallery page at https://terlanedesignstudio.wixsite.com/cardealer and add the next code.
import {local} from "wix-storage";
$w.onReady(function () {
$w("#dataset1").onReady(() => {
let numberOfItems = $w("#gallery1").items.length;
$w("#dataset1").getItems(0, numberOfItems-1)
.then((result) => {
let items = result.items;
let dynamicPageURLs = new Array();
items.forEach((item) =>{
dynamicPageURLs.push(item['link-VehicleDatabase-title']);
});
local.setItem('dynamicPageURLs', dynamicPageURLs);
})
.catch((err) => {
let errMsg = err.message;
let errCode = err.code;
console.log(errCode, errMsg);
});
});
});
The code assumes the following:
-
The ID of the dataset on the page is dataset1. You can verify it in the property panel.
-
The ID of the gallery is gallery1
-
The name of the dynamic page is VehicleDatabase (Title)
If that is not the case, find and replace the values in the code.
Go to the dynamic page and add the following code
import {local} from "wix-storage";
import wixLocation from 'wix-location';
$w.onReady(function () {
if (local.getItem('dynamicPageURLs')) {
let dynamicPageURLs = local.getItem('dynamicPageURLs');
if (dynamicPageURLs) {
dynamicPageURLs.split(',');
let currentPage = "/" + wixLocation.path.join('/');
let currentPageIndex = dynamicPageURLs.indexOf(currentPage);
if (currentPageIndex !== -1) {
if (currentPageIndex > 0) {
let prevPage = dynamicPageURLs[currentPageIndex - 1];
$w("#previous").onClick(() => {
wixLocation.to(prevPage);
});
$w("#previous").enable();
}
if (currentPageIndex < dynamicPageURLs.length) {
let nextPage = dynamicPageURLs[currentPageIndex + 1];
$w("#next").onClick(() => {
wixLocation.to(nextPage);
});
$w("#next").enable();
}
}
}
}
});
In the property panel:
-
Set both Next and Previous buttons IDs to be next and previous.
-
Uncheck the ‘Enabled by default’ for both buttons.
Let me know how it goes,
Shay
[Update - fixed a bug and now the code works with the dynamic page name VehicleDatabase]
Either I’m not doing this right, or its not working. I believe I’m not doing this right. Can I allow you to do it for me?
I think the code above has a bug.
this line:
dynamicPageURLs.push(item['link-Recipes-title']);
you should replace ‘link-Recipes-title’ with the name of the URL field in your vehicles collection.
Shay will verify this tomorrow.
try it out and let’s see.
p.s.
a short explanation of what Shay’s code is trying to do:
when the user open the gallery page, the code iterates over the all dataset items and extracts their URLs.
it then pushed this data into the browser’s local storage, where this data patiently waits.
in the vehicle’s item page, the code looks for the data from local storage, and searches for the index of the URL that matches the current page’s URL.
once it finds that index, it takes the next URL (the one with said index +1) and binds the “next” button to it.
it also takes the previous URL (the one with said index - 1) and binds that to the “prev” button.
hope it helps.
p.p.s.
this code only works for users who got to the item page after first visiting the gallery page.
users that find this page directly (e.g. via google) will not have anything in local storage so the next and prev buttons will be disabled.
to my mind this is reasonable… please share your thoughts.
denikatw I fixed a bug see in the above code sample.
hi Shay, can you help? I have used this coe on my site and it just won’t work. Brings up error Wix code SDK error: H is unsupported url. My site is https://tailoredwebdesign.wixsite.com/universesports-1/halloffame
Still isn’t working
Can you provide an error message?
did you open the console to see if there are any messages there?
We just added a new article demonstrating how create previous and next buttons for a dynamic item page.
https://support.wix.com/en/article/how-to-create-previous-and-next-buttons-for-a-dynamic-item-page
We’d appreciate any feedback on whether or not the article helped you create previous and next buttons on your dynamic item pages.
Hey Guys! It’s me again (lol)
I am using the expand and collapse codes for my FAQ page, is it me, or is there a way for that extra white space to expand and collapse along with the text?
I think this tutorial needs to be updated, as it now has some invalid code. For dynamicPageURLs…it now says " Argument of type ‘any’ is not assignable to parameter of type ‘string | number’. Type ‘any’ is not assignable to type ‘string’.
See image: