Coder Social home page Coder Social logo

Comments (3)

angelfernandezcic avatar angelfernandezcic commented on July 18, 2024

Any suggestions? I need to do 3 filters consecutive and i tried with the pipe but doesn´t work :(
v-for="item in filterBy(items, this.selectedMethod, 'ID_METHOD_PAID') | filterBy(items, this.selectedBudget, 'ID_TYPE_MONEY')"

from vue2-filters.

chriys avatar chriys commented on July 18, 2024

As of right now I don't think so. Vue filters don't support complex operations. Meaning you can't chain them in a v-for. The solution would have been to use them in a computed property but they aren't available there.
A solution might be to implement a callback to filterBy.

Vue Filters Rendering

from vue2-filters.

rbreaves avatar rbreaves commented on July 18, 2024

The answer is most likely to nest it - not pipe it. I am using orderBy and filter, but I assume you can nest them however you want. No idea about computing it or using a callback. While nesting does not look great it works fine for me.

<tr v-for="city in orderBy(cities,'name') | filterBy(cities, searchKey)">

to

<tr v-for="city in orderBy(filterBy(cities, searchKey),'name')">

from vue2-filters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.