Web Tutorials

BIGGEST AND FASTEST Web Tutorials – live24u.com

img
Home / JavaScript / Ajax / Sorting and Searching using Vuejs – Vuejs table sort pagination

Sorting and Searching using Vuejs – Vuejs table sort pagination

/
/
/
10 Views

Sorting and Searching using Vuejs – Vuejs table sort pagination

Welcome on live24u.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Sorting and Searching using Vuejs – Vuejs table sort pagination

You can download source code and Demo from below link.




In this post we will show you Best way to implement Sortable and searchable table with Vuejs and Bootstrap, hear for How to Searching and Sorting table with Vuejs and Bootstrap with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

index.html

<div id="demo" class="container">
  <input v-model="search" class="form-control" placeholder="Filter clients by clients_name or salary">

  <table class="table table-striped">
    <thead>
      <tr>
        <th v-repeat="column: columns">
          <a href="#" v-on="click: sortBy(column)" v-class="active: vsort == column">
            {{ column | capitalize }}
          </a>
        </th>
      </tr>
    </thead>
    <tbody>
      <tr v-repeat="clients | filterBy search | orderBy vsort reverse">
        <td>{{ clients_name }}</td>
        <td>{{ salary }}</td>
      </tr>
    </tbody>
  </table>
  <div class="form-group">
    <label>clients_name</label>
    <input type="text" class="form-control" v-model="createUser.clients_name" >
  </div>

  <div class="form-group">
    <label>salary</label>
    <input type="clients_name" class="form-control" v-model="createUser.salary" >
  </div>
  <button type="submit" class="btn btn-primary" v-on="click: addUser()">Add</button>
</div>

style.css

body {
  margin: 2em 0;
}

a {
  font-weight: normal;
  color: blue;
}

a.active {
  font-weight: bold;
  color: black;
}

index.html

new Vue({
  el: '#demo',

  data: {
    vsort: 'clients_name',

    reverse: false,

    search: '',

    columns: ['clients_name', 'salary'],

    createUser: {},

    clients: [
      { clients_name: 'jyoti', salary: 50 },
      { clients_name: 'kajal', salary: 22 },
      { clients_name: 'bhoomi', salary: 34 },
      { clients_name: 'dhara', salary: 15 },
      { clients_name: 'sejal', salary: 65 },
      { clients_name: 'neha', salary: 38 },
      { clients_name: 'madhavi', salary: 21 },
      { clients_name: 'chandni', salary: 50 },
      { clients_name: 'poonam', salary: 21 }
    ]
  },

  methods: {
    sortBy: function(vsort) {
      this.reverse = (this.vsort == vsort) ? ! this.reverse : false;

      this.vsort = vsort;
    },

    addUser: function() {
      this.clients.push(this.createUser);
      this.createUser = {};
    }
  }
});

You can download source code and Demo from below link.




Example

I hope you have Got Sorting a Table with Vue js Examples And how it works.I would Like to have FeadBack From My Blog(live24u.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(live24u.com) Are Most Always Welcome.

  • Facebook
  • Twitter
  • Google+
  • Linkedin
  • Pinterest

Vestibulum nec placerat orci. Mauris vehicula

Vestibulum nec placerat orci. Mauris vehicula,Vestibulum nec placerat orci. Mauris vehicula

Leave a Comment

Your email address will not be published.

It is main inner container footer text