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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@toast-ui/vue-grid

v4.21.22

Published

TOAST UI Grid for Vue

Downloads

2,027

Readme

TOAST UI Grid for Vue

This is Vue component wrapping TOAST UI Grid.

vue2 npm version

🚩 Table of Contents

Collect statistics on the use of open source

Vue Wrapper of TOAST UI Grid applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Grid is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. > “ui.toast.com") is to be collected and the sole purpose is nothing but to measure statistics on the usage. To disable GA, use the following usageStatistics option when declare Vue Wrapper compoent.

var options = {
  ...
  usageStatistics: false
}

📙 Documents

💾 Install

Using npm

npm install --save @toast-ui/vue-grid

🔡 Usage

Load

You can use Toast UI Grid for Vue as moudule format or namespace. Also you can use Single File Component (SFC of Vue). When using module format and SFC, you should load tui-grid.css in the script.

  • Using EcmaScript module

    import 'tui-grid/dist/tui-grid.css';
    import { Grid } from '@toast-ui/vue-grid';
  • Using Commonjs module

    require('tui-grid/dist/tui-grid.css');
    var toastui = require('@toast-ui/vue-grid');
    var Grid = toastui.Grid;
  • Using Single File Component

    import 'tui-grid/dist/tui-grid.css';
    import Grid from '@toast-ui/vue-grid/src/Grid.vue';
  • Using namespace

    var Grid = toastui.Grid;

Implement

First insert <grid> in the template or html. rowData and columnData props are required.

<grid :data="gridProps.data" :columns="gridProps.columns" />

Load grid component and then add it to the components in your component or Vue instance.

TOAST UI Grid has its own reactivity system, and does not use the reactivity system of Vue. So, instead of adding props in the data, declare props in the created lifecycle method.

import 'tui-grid/dist/tui-grid.css';
import { Grid } from '@toast-ui/vue-grid';

export default {
  components: {
    grid: Grid
  },
  created() {
    this.gridProps = {
      data: [
        // for rowData prop
        {
          name: 'Beautiful Lies',
          artist: 'Birdy'
        },
        {
          name: 'X',
          artist: 'Ed Sheeran'
        }
      ],
      columns: [
        // for columnData prop
        {
          header: 'Name',
          name: 'name'
        },
        {
          header: 'Artist',
          name: 'artist'
        }
      ]
    };
  }
};

Props

All the options of the TOAST UI Grid are supported in the form of props. Note that data and columns props are required and other props are optional.

<grid
  :data="gridProps.data"
  :columns="gridProps.columns"
  :rowHeaders="gridProps.rowHeaders"
  :columnOptions="gridProps.columnOptions"
></grid>
  • theme and language props have been deprecated since v2.1.0. Use static methods.

Event

All the events of TOAST UI Grid are supported in the form of on[EventName] props. The first letter of each event name should be capitalized. For example, for using click event you can use onClick prop like the example below.

<template>
  <div class="container">
    <grid
      :data="gridProps.data"
      :columns="gridProps.columns"
      @click="onClick"
    ></grid>
  </div>
</template>
<script>
import 'tui-grid/dist/tui-grid.css';
import { Grid } from '../src/index.js';

export default {
  components: {
    grid: Grid
  },
  methods: {
    onClick(ev) {
      console.log('click event: ', ev);
    }
  }
};
</script>

Method

For use method, first you need to assign ref attribute of element like this:

<grid ref="tuiGrid" :data="rows" :columns="columns" />

After then you can use methods through this.$refs. We provide getRootElement and invoke methods.

  • getRootElement

    You can get root element of grid using this method.

    this.$refs.tuiGrid.getRootElement();
  • invoke

    If you want to more manipulate the Grid, you can use invoke method to call the method of tui.grid. First argument of invoke is name of the method and second argument is parameters of the method. To find out what kind of methods are available, see method of tui.grid.

    const info = this.$refs.tuiGrid.invoke('getFocusedCell');
    this.$refs.tuiGrid.invoke('setWidth', 500);

Static Methods

The wrapper component does not provide a way to call static methods of TOAST UI Grid. If you want to use static methods such as applyTheme or setLanguage you should use it via importing tui-grid directly.

import TuiGrid from 'tui-grid';

TuiGrid.setLanguage('ko');
TuiGrid.applyTheme('striped');