top of page

Filtrar Repetidor

Hey! Qué tal? En este nuevo video, aprenderás como filtrar un repetidor en Wix, usando un dataset, dropdowns y algunos inputs, y por supuesto, velo. No olvides subscribirte y comentar alguna pregunta!




 

import wixData from 'wix-data'; $w.onReady(function () {}); function checkItems(counter) { console.log('counter', counter); if (counter <= 0) { $w("#noItems").text = "No se encontraron elementos que coincidan"; $w("#noItems").show(); } } function filtrar(location, min, max) { $w("#noItems").hide(); console.log('location', location); console.log('min', min); console.log('max', max); let myFilter = wixData.filter(); if (location) { myFilter = myFilter.eq("ubicacion", location) } if (min) { myFilter = myFilter.ge("precio", min) } if (max) { myFilter = myFilter.le("precio", max) } $w("#dataset1").setFilter(myFilter).then(() => { let counter = $w("#dataset1").getTotalCount(); checkItems(counter); }) } export function filtrar_click(event) { let location = $w("#dropdown1").value; let min = parseInt($w("#input1").value); let max = parseInt($w("#input2").value); filtrar(location, min, max); } export function borrarFiltros_click(event) { $w("#noItems").hide(); $w("#dataset1").setFilter(wixData.filter()); $w("#dropdown1").value = undefined; $w("#input1").value = undefined; $w("#input2").value = undefined; }



 

Gracias por ver el vídeo!


89 views0 comments
bottom of page