npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ajax-table-vue

v1.0.2

Published

Vue module for asynchronous data management

Readme

ajax-table-vue

Vue module for asynchronous data management


Getting started

Install the package

To install this package, simply install ajax-table-vue with your favorite package manager:

# Using npm
npm install ajax-table-vue

Import the package

Use the ESM build

The [ESM] build (EcmaScript Module) implies that your target browsers supports ESM OR you use a bundler, like webpack, rollup.js or Parcel.

Import & register two main components in Vue globally:

import Vue from 'vue';
import {AjaxTable, Column} from 'ajax-table-vue';

Register two main components globally:

Vue.component('ajax-table', AjaxTable);
Vue.component('column', Column);

Or locally:

const app = new Vue({
    el: '#app',
    components: {
        'ajax-table': AjaxTable,
        'column': Column
    }
});

Base usage

Use the components in your HTML or template:

Note: uri endpoint must be POST

<div id="app">
    <ajax-table uri="https://endpoint-for-data">
    <!-- columns base config -->
       <template #columns>
           <column label="Id" name="id"></column>
           <column label="Name" name="name"></column>
       </template>
    </ajax-table>
</div>

Customize the table

filtering and sorting

You can disable or enable filtering and sorting using the following non-required props(they are by default - true): filterable, sortable. Here's an expample:

...
<column label="Name" name="name" :filterable="false" :sortable="true"></column>
...

filtering input

You can customize filtering input in columns like this:

<div id="app">
    <ajax-table uri="https://endpoint-for-data">
    <!-- columns base config -->
       <template #columns>
           <column label="Id" name="id"></column>
           <column label="Name" name="name"></column>
       </template>
       
       <!-- Note: column name should go after #filter- -->
        <template #filter-id="{filters, col}">
            <select v-model="filters[col]">
                <option value="" selected>-</option>
                <option>1</option>
                <option>2</option>
            </select>
        </template>
    </ajax-table>
</div>

table values customization

<div id="app">
    <ajax-table uri="https://endpoint-for-data">
    <!-- columns base config -->
       <template #columns>
           <column label="Id" name="id"></column>
           <column label="Name" name="name"></column>
       </template>
       
       <!-- Column specific value customization -->
       <!-- Note: column name should go after #value- -->
        <template #value-id="{value}">
            {{ value !== null ? value : 'No data available' }}
        </template>

       <!-- All column values customization -->
       <!-- Will be overwritten if column specific value customization is present  -->
        <template #value="{value}">
            {{value !== null ? value : 'No data'}}
        </template>
    </ajax-table>
</div>

adding actions

All action components should be extended from ActionButton component:

import {ActionButton} from 'ajax-table-vue';

Vue.component('action-button-delete', {
  extends: ActionButton,
  data: function () {
    return {
    }
  },
  methods: {
    alertId() {
        alert(this.row.id);
    }
},
  template: '<button @click.prevent="alertId"><slot>Delete</slot></button>'
})
<div id="app">
    <ajax-table uri="https://endpoint-for-data">
    <!-- columns base config -->
       <template #columns>
           <column label="Id" name="id"></column>
           <!-- Actions column, name must be equal: 'actions' -->
           <column label="Actions" name="actions"></column>
           <column label="Name" name="name"></column>
       </template>

        <!-- variable row allows to access all values in a row -->
        <template #actions="{row}">
            <action-button-delete :row="row"></action-button-delete>
            <action-button-delete :row="row"></action-button-delete>
        </template>
    </ajax-table>
</div>

Data structure

Data being received from the server

{
    "0": {
        "id": 1,
        "name": "Name"
    },
    "1": {
        "id": 2,
        "name": "Another name"
    },
    "meta": {
        "pagination": {
            "total_pages": 2
        }
    }
}

Data being sent to the server

Using filtering and sorting:

{
"filter":[
    {
    "col":"name",
    "value":"qwe"
    }
],
"sort":{
    "col":"id",
    "order":"desc"
},
"page":1
}

Without using filtering and sorting:

{
"filter":[],
"sort":{},
"page":1
}