Filter Table or List Result In VueJs

In Vuejs 1 , there was an inbuilt filter to filter table result using filterBy but in Vuejs 2 it was deprecated.

Hence you need to write your own custom query to achieve same result.

This tutorial will show you how to achieve same.

The application server is written in nodejs , express as the web framework and vash as the template engine.

I will be using a fake an API from

This is the nodejs server code

var express = require("express");
var app = express();

var port = process.env.PORT || 3000;

app.use("/assets", express.static(__dirname + "/public"));

app.set("view engine", "vash");

app.get("/", (req, res) => {


Next is the View i.e the html to display our data and provide search.

<link rel="stylesheet" type="text/css" href="" media="screen"
<div class="container">
    <h1>Filter Todo Table By Search in VueJs
            <i class="glyphicon glyphicon-filter"></i>)</small>
    <div class="row">
        <div class="col-md-6" id="todo"> 
            <div class="panel panel-success">
                <div class="panel-heading">
                    <h3 class="panel-title">TODOS</h3> 
                <div class="panel-body">
                    <input type="text" class="form-control" placeholder="search" v-model="search"/>
                <table class="table table-hover">
                        <tr v-for="(item,index) in computedData" :key="">
                            <td>{{ ++index }}</td>
                            <td>{{ }}</td>
                            <td>{{ item.username }}</td>
                            <td>{{ }}</td>


<script src=""></script>
<script src=""></script>  
<script src="/assets/data.js"></script>

Finally , the Vuejs code

var app = new Vue({
  el: "#todo",
  data: {
    todos: [],
  mounted() {
    loadAll: {
        .then(response => {
          this.todos =;
        .catch(function(error) {});
  computed: {
    computedData: function() { 
      this.computedTodos = this.todos;  
      if ( {
        this.computedTodos = this.computedTodos.filter(item => || item.username.toUpperCase().includes( ||;   
        return this.computedTodos;
      return this.computedTodos;

Snapshot of the html table.


Search for BRET

Source on my github page


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s