vue js Grid Component vue Datatables

vue js Grid Component vue Datatables

In this Post We Will Explain About is vue js Grid Component vue Datatables With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Vue.JS – Advanced Data Grid Component Example

In this post we will show you Best way to implement vue js grid component, hear for Building a grid component in Vue.js with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Vue Data Table Component

In this Example,First of all Add or Inluce 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 priorty set.After that Include your relavant CSS Class.

READ :  Vuejs Pagination Searching and Sorting of DataTable

index.html

<div id="liveApp">
  <form id="live-search">
    Search
    <input name="query" v-model="live-searchQuery">
  </form>
  <data-grid :data="gridData" :columns="gridColumns" :filter-key="live-searchQuery">
  </data-grid>
</div>
<script type="text/x-template" id="vuegrid">
  <table>
    <thead>
      <tr>
        <th v-for="key in columns" @click="sortBy(key)" :class="{ active: liveSortKey == key }">
          {{ key | capitalize }}
          <span class="arrow" :class="studSort[key] > 0 ? 'asc' : 'dsc'">
          </span>
        </th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="entry in data_filters">
        <td v-for="key in columns">
          {{entry[key]}}
        </td>
      </tr>
    </tbody>
  </table>
</script>

index.js

// Source: https://www.infinityknow.com/
console.log(Vue.version);
var studentsData = [{
  "name": "jkd assertive Company",
  "sections personal": 10,
  "student Engagement & sections": 7,
  "Financial Futures & expens": 9,
  "Health & people-Friendly Futures": 9,
  "Physical university": 10,
  "stud_bus & perfomance Development": 9,
  "summer holidya & Personal Time-Off": 6,
  "Work data-content & information": 10,
  "Total target": 70
}, {
  "name": "Live24u comapy private limited",
  "sections personal": 9,
  "student Engagement & sections": 6,
  "Financial Futures & expens": 7,
  "Health & people-Friendly Futures": 9,
  "Physical university": 7,
  "stud_bus & perfomance Development": 9,
  "summer holidya & Personal Time-Off": 9,
  "Work data-content & information": 9,
  "Total target": 65
}, {
  "name": "Accenture Inc.",
  "sections personal": 10,
  "student Engagement & sections": 9,
  "Financial Futures & expens": 7,
  "Health & people-Friendly Futures": 9,
  "Physical university": 7,
  "stud_bus & perfomance Development": 7,
  "summer holidya & Personal Time-Off": 6,
  "Work data-content & information": 9,
  "Total target": 64
}];

Vue.component('data-grid', {
  template: '#vuegrid',
  props: {
    data: Array,
    columns: Array,
    filterKey: String
  },
  data: function() {
    var studSort = {}
    this.columns.forEach(function(key) {
      studSort[key] = 1
    })
    return {
      liveSortKey: '',
      studSort: studSort
    }
  },
  computed: {
    data_filters: function() {
      var liveSortKey = this.liveSortKey
      var filterKey = this.filterKey && this.filterKey.toLowerCase()
      var order = this.studSort[liveSortKey] || 1
      var data = this.data
      if (filterKey) {
        data = data.filter(function(row) {
          return Object.keys(row).some(function(key) {
            return String(row[key]).toLowerCase().indexOf(filterKey) > -1
          })
        })
      }
      if (liveSortKey) {
        data = data.slice().sort(function(a, b) {
          a = a[liveSortKey]
          b = b[liveSortKey]
          return (a === b ? 0 : a > b ? 1 : -1) * order
        })
      }
      return data
    }
  },
  filters: {
    capitalize: function(str) {
      return str.charAt(0).toUpperCase() + str.slice(1)
    }
  },
  methods: {
    sortBy: function(key) {
      this.liveSortKey = key
      this.studSort[key] = this.studSort[key] * -1
    }
  }
})

var vueApp = new Vue({
  el: '#liveApp',
  data: {
    live-searchQuery: '',
    gridColumns: Object.keys(studentsData[0]),
    gridData: studentsData
  }
})

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

READ :  vuejs datatable example - Datatable component using Vuejs-vuejs datatable

Example

I hope you have Got What is best ui framework for web application And how it works.I would Like to have FeaeBack From My Blog(infinityknow.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Add a Comment

Your email address will not be published. Required fields are marked *