Tagged: vue orderby filter

Vuejs filterBy orderBy CustomFilter Example 0

Vuejs filterBy orderBy CustomFilter Example

Vuejs filterBy orderBy CustomFilter Example

In this Post We Will Explain About is Show-Hide Password in TextBox with Button using jQuery With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to vuejs orderBy filter Example

In this post we will show you Best way to implement vuejs orderBy filter example, hear for vuejs orderBy filter example with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

In this Example,First of all Add or Include External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priority set.After that Include your relevant CSS Class.

Include External Libs

https://cdnjs.cloudflare.com/ajax/libs/vue/0.12.14/vue.min.js
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css

index.html

<div id="liveApp">
    
    <br />
    <label> All</label>
    <label> Male</label>
    <label> Female</label>
    <br />
    <table class="table">
      <thead>
        <tr>
          <th>
            <a>
              {{ column | capitalize }}
            </a>
          </th>
        </tr>
      </thead>
      <tr>
        <td>{{ Council_members }}</td>
        <td>{{ usertype }}</td>
        <td>{{ age }}</td>
      </tr>
  </table>
</div>

index.js

var liveApp = new Vue({
    el: '#liveApp',
    data: {
        sortKey: '',
        reverse: false,
        query_search: '',
        columns: ['Council_members', 'usertype', 'age'],
        usertype: 'all',
        people: [
          {Council_members: 'Narendra Modi', age: 30,usertype:'male'},
          {Council_members: 'Rajnath Singh', age: 20,usertype:'female'},
          {Council_members: 'Sushma Swaraj', age: 12,usertype:'female'},
          {Council_members: 'Arun Jaitley', age: 67,usertype:'male'},
          {Council_members: 'Manohar Parrikar', age: 15,usertype:'female'},
          {Council_members: 'Arun Jaitley', age: 12,usertype:'male'}
        ]
    },
    methods: {
      sortBy: function(sortKey){
          this.reverse = this.sortKey==sortKey? !this.reverse : false
          this.sortKey = sortKey
      }
    },
    filters:{
      usertype: function(people){  
        if(this.usertype=='all') return people
        return people.filter(function(person){
          return person.usertype == this.usertype
        }.bind(this))
      }
    }
})

style.css

body{ margin: 50px}
a.active{ color: #3D3D3D}

vuejs orderBy filter example

Example

I hope you have Got What is sorting – Vuejs 2 using filterBy and orderBy in the same computed And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.