Multiple reference field code. Does anybody try it?

I have a question. When i getcurrentitem() of the item. There is no info in array of multiple reference field. Where can i get info of this field in code. I want to display in repeator info what categories has ma item. (category is reference field) each item has many categories. Please help. Thanks

When you use getCurrentItem don’t you get a list of all the ids of all the categories? Then you can hook up another dataset or query to show the names of those categories. What do you get from that field.

Have you added “include” into your query? Look here: WixDataQuery - Velo API Reference - Wix.com

2 Likes

If you use a dataset you don’t get the .include function as you are in using wixData.query. But Giri is correct that you would benefit a lot of using a query.

Try this approach

$w.onReady( () => {
  $w("#myDataset").onReady( () => {
    let itemObj = $w("#myDataset").getCurrentItem();
    // Investigate if itemObj.categoryfieldkey contains something
    console.log(itemObj);
  } );

} );

And paste that result in here

1 Like

it shows datas of item but without category. If i have normal category not “multiple items” it shows. But i have categories in reference field.

I need it to
_id:
“abb7f8e5-449f-4842-ac1c-45b7fabdbe33”
_owner:
“5c4794ca-8ac7-4193-9e61-6bf81eb53307”
_createdDate:
“2018-11-22T23:16:06.671Z”
_updatedDate:
“2018-11-25T20:56:44.815Z”
nazwa:
“szkola”
opis:
“fhfh”
ilosc:
23

When i make query with include. i still get id of one category :frowning: