Hello, I used the code proposed in the example https://www.wix.com/corvid/example/mega-search
, where a repeater is fed from the result of a query
I use a primary collection “Events” and 2 secondary collection “compagnie” and 'salleLieu"
Repeater uses data and it is displayed correctly of the data coming from 3 collections
The user can filter the results, and there are no problems when the filter uses data from the primary collection, but I don’t know how to filter based on secondary data ?
Below, the code (simplified) that i used :
import wixData from 'wix-data';
import { debounce } from 'lodash';
$w.onReady(
function () {
initRepeater();
buildFiltersAndPopulateRepeater();
}
);
async function buildFiltersAndPopulateRepeater() {
let dataQuery = wixData.query('Events').include('compagnie').include('salleLieu').limit(200);
// if #isalle is validated, this code works, and query is correctly filtered :
// NameField is a field of the collection Events
if ($w('#iSalle').value) {
dataQuery = dataQuery.eq('NameField', $w('#iSalle').value);
}
// if #iDepartment is validated, this code does not work, and query is empty :
// departement is a field of the collection salleLieu
if ($w('#iDepartment').value) {
dataQuery = dataQuery.eq('salleLieu.departement', $w('#Department').value);
}
// this code and the rest is good
if ($w('#iTri').value) {
dataQuery = dataQuery.ascending($w('#iTri').value) ;
}
$w('#repeaterEvenement').data = await dataQuery.find().then((res) => res.items);
}
function initRepeater() {
// field of Events :
$item('#txtDate').text = itemData.date ;
$item('#btnLieu').label = itemData.salleLieu.title;
$item('#txtTitre').text = itemData.title;
$item('#txtSousTitre').text = itemData.infoSpcialeSoustitre;
$item('#txtDetail').text = itemData.dtail;
// fields of salleLieu :
if (itemData.salleLieu) {
$item('#btnLieu').link = itemData.salleLieu['link-salles-lieux-title'];
$item('#txtDeptVille').text = itemData.salleLieu.departement;
}
// fields of compagnie
if (itemData.compagnie) {
$item('#btnCompagnie').label = itemData.compagnie.title;
$item('#btnCompagnie').link = itemData.compagnie['link-compagnies-1-title'] ;
$item('#btnCompagnie').style.color = "#0000FF" ;
}else{
$item('#btnCompagnie').label = "?";
}
});
}
have you ever had this experience? Did you find a solution ?