Hello,
I have a repeater with a list of members associated with a dataset.
I put buttons to make an alphabetical index.
I wrote a function that displays the results in the repeater according to the button clicked (button A, button B, etc ...)
Here is the code of the function:
function filtrage(Malettre){
$w("#teamDataset").setFilter( wixData.filter()
.startsWith("title", Malettre)
)
.then( () => {
//console.log("Dataset is now filtered");
})
.catch( (err) => {
console.log(err);
} );
}
I would like to display a message, if there is no result; How do I change my code?
Thank you for your help.
Add the text element to your page. Make it collapsed on load.
function filtrage(Malettre){ $w("#teaxtMessage").collapse(); $w("#teamDataset").setFilter( wixData.filter() .startsWith("title", Malettre) ) .then(() => { const totalCount = $w("#teamDataset").getTotalCount(); if(totalCount < 1){ $w("#teaxtMessage").expand(); } }) .catch(err => console.log(err)); }
Ok I will put in 2 languages.
I'm trying to do a simple string comparison but I don't know which javascript language elements are accepted by "Velo".
For example: extract a substring with "substr" or "substring" ? A test like the one below is not accepted:
if (substring(valeur,0,5)=="https") { $w('#btnlinkcv').show(); } else { $w('#btnlinkcv').hide(); }
Where can I find a glossary of accepted key words?
I searched in the "VeloReférence" but I did not find?
J'essaye de faire une simple comparaison de chaine mais je ne sais pas quels éléments du langage javascript sont accéptés par "Velo".
Par exemple : extraire une sous chaines avec "substr" ? Un test comme celui ci-dessous n'est pas accépté :
if (substr(valeur,0,5)=="https") { $w('#btnliencv').show(); } else { $w('#btnliencv').hide(); }
Où peut-on trouver un glossaire des molts-clés acceptés ?
J'ai cherché dans le "VeloReférence" mais je n'ai pas trouvé ?
Et il est pas tout seul, c'est parfait vu mon faible niveau en anglais. lol.
Merci JD , l'annulation de filtre marche parfaitement.
Si je comprends bien, tu parles français. Donc inutile que je m'embête à traduire en anglais. Ouf ça m'arrange bien.
Pour la deuxième question je reformule :
En fait je n'arrivais pas à faire le lien entre les "membres" de la page dynamique (All) avec les éléments individuels (fiche). Mais j'ai résolu le problème en ajoutant un bouton dans le répéteur et en établissant le lien avec "Membre(fiche).
Le problème est donc résolu.
Merci encore.
I also have another problem:
My repeater works fine with its alphabetical index but I don't know how to link each item to its individual dynamic page.
Initially it worked with the dynamic "All" page generated by wix. But since I replaced the content offered in the "All" page with my repeater, the links no longer work.
I feel like I'm going to overdo it a bit ...
The code works perfectly well with your indications. Cool.
But I would also like to be able to display all the members when the user clicks on the "all" button ('Tout' in French). But I don't know how to do that, unless there is a generic character that I can use with my "Filter" function Like "*" example
"export function ba_click (event) {filtering (" * ");}? but it doesn't work as it seems.
Attached is an excerpt from my page
Thank you very much, it's really cool that answer.