Bug/s? Gallery kinds and population by code (map method)

Hi

  1. I can’t identify type of existing gallery except Pro in Editor (mouse hover)
  2. I can’t get title and description (in preview) on regular Slider gallery connected to nothing (text added to number of images)
  3. slider gallery → customize design->text-> “text link” instead of “colour”
  4. For Pro gallery title position exists only for Grid and only for vertical scrolling without possibility to set number of rows
  5. I need gallery (slider) populated with pictures and authors names from Collections (without Dataset)
    I have 2 collections: Items and Persons
    Items with reference field to Persons (key iAuthor) and Dynamic Page for each item (key link-Items-iID)
    I get iAuthor properties in query results but “undefined” in description. I get working static link, but unrecognised field key in link. There is more: if description is undefined even static link doesn’t work.
    How I’ll make it work?

Please your help

import wixData from ‘wix-data’;
let iQuery = wixData.query(‘Items’);
function setItemsTGallery() {
iQuery
.include(“iAuthor”)
.find()
.then((results) => {
let itemsDesc = results.items.map( function (item) {
return ({
description: “desc2”, //??? item.iAuthor.pFirstName+ ’ ’ + item.iAuthor.pLastName,
src: item.iImage, //work
title: item.iName, //work
link: “/Items/”+item.iID //??? item.link-Items-iID
})
});
$w(“#itemsGallery”).items = itemsDesc;
})
. catch ((error) => {
let errorMsg = error.message;
let code = error.code;
});
}

Hello Zufi,

1.You can get the id of the gallery by clicking on it or hovering, if this is what you mean by type of gallery.
2. You can connect your gallery to your database and get the data from their for title and description
3. You can customize the design of your gallery to a certain extent, if you are looking for a more customize-able gallery I would suggest using a repeater.
4. Again customization on a Wix Pro gallery is limited, look into using a repeater if possible
5. This can be done with a dataset and reference field and does not need code.

Some links that may help:

Thanks for reply but

  1. clicking on doesnt work and hovering already tested (see in text) the only indetifier that i get is word “Pro” for Pro Gallery. What about “Grid” “Slider” for regular one?
  2. even before I am trying to connect to database when I have static gallery (slider) with title and decription I can’t see them in preview
  3. it is not about alternatives for gallery, it’s about wrong title or ? in interface
  4. will try the dataset but I have 2 galleries for the same collection with different filters and prefer direct access, the strange thing that map method work only for 2 options from 4
  1. Try refreshing your page sometimes elements bug out
  2. Try syncing your database in sandbox mode to live, most likely your data is only in preview mode
  1. No, close tab open editor doesn’work (Chrome and Safari)
  2. The site is not published yet, it is preview
    Are You from Wix Team

Try making sure all of the fields you are entering in your database match with the correct database field value.
Also try:

link: item['item.link-Items-iID']

and

 description: item.pFirstName+ ' ' + item.iAuthor.pLastName

Let me know if this works,
Majd

link suggestion doesn’t work

description: ittem.iAuthor.pFirstName doesnt work
description:: item.pLastName doesn’t work
I suppose the problem is map method and “for each” will work because
description: results.items[0].iAuthor.pFirstName does work in map method
So?

Hello Zufi can you give me your websites URL so that I may check exactly whats going on?
Thanks,
Majd

Thank You for Trying to help
seniorsartmuseum.org->mysite->new page (2 galleries are prepared for testing, feel free to change)

Hello Zufi,

It seems that you were getting the data from the collection in a wrong way. I have fixed it on your website for you to check out. The main problem was that you were searching the object you get back from the query in a incorrect way.

Instead of what you have, it should be:

description: item.iAuthor.pFirstName,
link: item['link-Items-iID'] )

Best,
Majd

Thank You for your effort
I did restore to your version, but can’t see the changes in code or in behaviour.
There is right console.log from collection (not from gallery) and just twice. Why? Nothing for link or description in preview mode. Even title that I got for Items gallery is not there (I described this behaviour before)
Please let me know what was wrong in my search and where exactly

Nothing wrong with search.
The problem was 1 empty cell in reference field (column) in Collection, the same reference field that in include.
So…
How I deal with this? It’s clear that not always I have reference data.
The second question:
Why when I have 1 include I get ALL the data (I have 2 reference fields in 1 Collection)?

Hello Zufi,

That’s great that you managed to find a solution! Well done, the next step would be to create an if statement that checks to see if that field is empty, and show a placeholder if it is (or hide or anything you want to do when it is empty), and proceed regularly with the code if that field is not empty.

Best of luck,
Majd

Hello Majd,
Sorry to say it but it is definitely the bug for “include”. Please report it.
Absent of empty data possibility for “reference field” is opposite to the sense of “reference field”.
The issue is “include” behavior, not what to display/hide

There is additional issue as mentioned in my previous post: 1 include → ALL included
Please report to QA
Thank You

Hello Zufi,

Will do! Appreciate your feedback.

Best,
Majd