Giter VIP home page Giter VIP logo

toast-ui.vue-grid's Introduction

โš ๏ธNotice: This repository is deprecated๏ธ๏ธ๏ธ๏ธ๏ธ

TOAST UI Grid Vue Wrapper has been managed separately from the TOAST UI Grid repository. As a result of the distribution of these issues, we decided to deprecated each wrapper repository and manage repository as a mono-repo from the TOAST UI Grid repository.

From now on, please submit issues or contributings related to TOAST UI Vue Wrapper to TOAST UI Grid repository. Thank you๐Ÿ™‚.

TOAST UI Grid for Vue

This is Vue component wrapping TOAST UI Grid.

vue2 github version npm version license PRs welcome code with hearth by NHN

๐Ÿšฉ 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

You can use rowData, columnData, options, theme and language props. Example of each props is in the Getting Started.

  • rowData, columnData

    Type Required
    Array or Object O

    These props are row and colume data of the grid. If you change rowData or columnData, the grid is rendered to change data.

  • options

    Type Required
    Object X

    You can configurate your grid using options prop. For more information which properties can be set in options, see options of tui.grid.

  • theme

    Type Required
    String or Object X

    This prop can change theme of the grid. We support default, striped and clean themes. So in case you just set String of these themes.

    If you want to use other theme, you set Object that is required name and value. For more information which properties of value are available, see extOptions of applyTheme of tui.grid.

  • language

    Type Required
    String or Object X

    This prop can change language of the grid. We support en and ko. So in case you just set String of these languages.

    If you want to use other languages, you set Object that is required name and value. For more infomation which properties of value are available, see data of setLanguage of tui.grid.

Event

  • click : Occurs when a mouse button is clicked on the Grid.
  • check : Occurs when a checkbox in row header is checked.
  • uncheck : Occurs when a checkbox in row header is unchecked.
  • dblclick : Occurs when a mouse button is double clicked on the Grid.
  • mouseover : Occurs when a mouse pointer is moved onto the Grid.
  • mouseout : Occurs when a mouse pointer is moved off from the Grid.
  • mousedown : Occurs when a mouse button is downed on the Grid.
  • focusChange : Occurs when focused cell is about to change.
  • expand : Occurs when the row having child rows is expanded.
  • collapse : Occurs when the row having child rows is collapsed.
  • beforeRequest : Occurs before the http request is sent.
  • response : Occurs when the response is received from the server.
  • successResponse : Occurs after the response event, if the result is true.
  • failResponse : Occurs after the response event, if the result is false.
  • errorResponse : Occurs after the response event, if the response is Error.
  • selection : Occurs when selecting cells.

For more information such as the parameters of each event, see event of tui.grid. Example of event is in the Getting Started.

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');

๐Ÿ”ง Pull Request Steps

TOAST UI products are open source, so you can create a pull request(PR) after you fix issues. Run npm scripts and develop yourself with the following process.

Setup

Fork develop branch into your personal repository. Clone it to local computer. Install node modules. Before starting development, you should check to have any errors.

$ git clone https://github.com/{your-personal-repo}/[[repo name]].git
$ cd [[repo name]]
$ npm install

Develop

Let's start development!

Pull Request

Before PR, check to test lastly and then check any errors. If it has no error, commit and then push it!

For more information on PR's step, please see links of Contributing section.

๐Ÿ’ฌ Contributing

๐Ÿ“œ License

This software is licensed under the MIT ยฉ NHN.

toast-ui.vue-grid's People

Contributors

js87zz avatar jungeun-cho avatar ryum91 avatar sohee-lee7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

toast-ui.vue-grid's Issues

destroyed ์ƒํƒœ ์‹คํ–‰ ํ•จ์ˆ˜ ๋‚ด ์—๋Ÿฌ

Version

2.0.0

Test Environment

tui.grid 4.0.3

Current Behavior

image
Tui grid๋ฅผ toast-ui.vue-grid๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ์ค‘์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ๋Š” tui.grid 4.0.3 ๋‚ด์— ํฌ๋กœํ†  ํƒ€์ž… ํ•จ์ˆ˜ ์ค‘ destroy ํ•จ์ˆ˜๊ฐ€ ์‚ฌ๋ผ์กŒ๋”๊ตฐ์š”. ์ด์ „์— ์‚ฌ์šฉํ•˜๋˜ tui.grid 3.8.0์—์„œ๋Š” ์กด์žฌํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Expected Behavior

tui grid ๋‚ด destory ํ•จ์ˆ˜๋ฅผ ๋Œ€์ฒดํ•˜๋Š” ๊ธฐ๋Šฅ์ด ์žˆ๋Š” ์ง€์š”?
vue wrapper์˜ ๋ณ€๊ฒฝ์ด ํ•„์š”ํ•  ๊ฒƒ์ด๋ผ ๋ณด์ž…๋‹ˆ๋‹ค.

์—ฌ๋‹ด์œผ๋กœ, ๊ธฐ์กด ๊ธฐ๋Šฅ ์ค‘ data์™€ colums๋ฅผ watch์—์„œ ์ธ์ง€ํ•˜์—ฌ ์žฌ ๋ณ€๊ฒฝ ํ–ˆ๋Š”๋ฐ, 2.0 ๋ฒ„์ „์—์„œ๋Š” ์‚ฌ๋ผ์กŒ๋”๊ตฐ์š”. ํ˜น์‹œ ์˜๋„ํ•˜์‹  ๊ฑด์ง€? ์˜๋„ ํ•˜์‹  ๊ฑฐ๋ฉด tui grid ์‚ฌ์šฉ ํ•˜๋Š” ๋ถ€๋ถ„์—์„œ ์ง์ ‘ resetData๋ฅผ ํ•ด์•ผํ•˜๋Š”์ง€ ์•Œ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

์ฐธ๊ณ ,

  • tui grid 3.8.0 ํ”„๋กœํ†  ํƒ€์ž…
    image

  • tui grid 4.0.3 ํ”„๋กœํ†  ํƒ€์ž…
    image

[email protected]๋ฅผ wrapping ํ•˜๋Š” ๋ฒ„์ „์˜ ๋ฆด๋ฆฌ์ฆˆ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

Version

[email protected]

Test Environment

os: windows 10
browser: chrome
Vue: 2.6.10 ( vue/[email protected])
typescript: 3.4.3

Current Behavior

@[email protected] (2.0.0 ์ง์ „ ์ตœ์‹  ๋ฒ„์ „)์—์„œ
@2.0.0์œผ๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ์‹œ์— ์•„๋ž˜์™€ ๊ฐ™์€ typescript ๊ด€๋ จ ์—๋Ÿฌ๊ฐ€ ๋‹ค์ˆ˜ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

  > 290 |         columns.forEach((item: tuiGrid.IColumnInfoOptions, index: number) => {
        |                                        ^

tui-grid 3.8.0 ์—์„œ 4.0.0 ~ 4.1.0์œผ๋กœ ๋Œ€๊ทœ๋ชจ ๋ณ€๊ฒฝ์ด ์ด๋ค„์ง€๋ฉฐ, ์—ฌ๋Ÿฌ ํƒ€์ž…๋“ค์ด ์‚ญ์ œ ํ˜น์€ ๋ณ€๊ฒฝ๋˜๊ณ , method ๋˜ํ•œ ๊ทธ๋Ÿฌํ•˜์—ฌ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด ์‰ฝ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
๊ธฐ์กด tui-grid์— issue ๋“œ๋ ธ๋˜ (nhn/tui.grid#396 (comment)) ์™€ (nhn/tui.grid#396 (comment)) ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜๊ณ ์ž 3.9.0๋ฅผ ์ด์šฉํ•˜๋Š” Vue wrapper๊ฐ€ ํ•„์š”ํ•˜์—ฌ ์š”์ฒญ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

Expected Behavior

[email protected]์—์„œ [email protected]์œผ๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ƒˆ๋กœ์šด [email protected] ๋ฒ„์ „์˜ ์ง€์›์„ ๋ฐ”๋ž๋‹ˆ๋‹ค!

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

addClassName ๋ฐ˜์˜๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

Version

1.0.3

Test Environment

ํฌ๋กฌ , ๋งฅ ๋ชจํ•˜๋น„

Current Behavior

< div> <v-btn color="info" @click='gridControl("cell_color_change")'>cell color change</v-btn> <v-btn color="info" @click='gridControl("get_value")'>Get Value</v-btn> < div> < grid ref="tuiGrid" :rowData="data" :columnData="columns" /> </ div > </ div >
gridControl(flag){
if (flag == "get_value" ){
let row = this.$refs.tuiGrid.invoke('getValue','1','artist',true);
alert(row);
}else if (flag == "cell_color_change"){
this.$refs.tuiGrid.invoke('addCellClassName', '1','artist','cell-red');
}
}

<style> .tui-grid-cell.cell-red {background-color: red} </style>

``
์œ„ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋กœ ํ…Œ์ŠคํŠธํ•˜๊ณ ์žˆ๋Š”๋ฐ ์‹ค์ œ ๋‹ค๋ฅธ ๋ฉ”์†Œ๋“œ๋“ค์€ ์ž˜ ์ž‘๋™ํ•˜๋Š”๋ฐ ์—๋ฅผ๋“ค์–ด
getValue๋‚˜ getRows๋“ฑ ์›ํ•˜๋Š”๊ฐ’๋“ค์ด ์ž˜ ์ถœ๋ ฅ๋˜๋Š”๋ฐ
๋ฐฐ๊ฒฝ์ƒ‰์„ ๋ฐ”๊พธ๊ธฐ ์œ„ํ•ด addClassName์„ ํ˜ธ์ถœํ•˜์˜€์„๊ฒฝ์šฐ ๋ฐ˜์˜์ด ์•ˆ๋˜๊ณ ์žˆ์Šต๋‹ˆ๋‹ค.
ํฌ๋กฌ ์š”์†Œ๊ฒ€์‚ฌ์—์„œ ์ˆ˜๋™์œผ๋กœ cell-red๋ฅผ ์ถ”๊ฐ€ํ•˜์˜€์„์‹œ ๋ฐฐ๊ฒฝ์ƒ‰์ด ์ž˜ ๋ณ€๊ฒฝ๋˜๋Š”๊ฒƒ์„ ํ™•์ธํ•˜์˜€์Šต๋‹ˆ๋‹ค.
ํ•ด๋‹น ๋ฉ”์†Œ๋“œ๊ฐ€ ์ •์ƒ ์ž‘๋™ ํ•˜์ง€ ์•Š๋Š”๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Expected Behavior

addClassNameํ˜ธ์ถœ์‹œ ๋ฐ”๋กœ ์›ํ•˜๋Š” ํด๋ž˜์Šค๊ฐ€ ํ•ด๋‹น ์…€์— ์ถ”๊ฐ€๋˜์—ˆ์œผ๋ฉด ํ•ฉ๋‹ˆ๋‹ค.

[@toast-ui/vue-grid] formatter ์‚ฌ์šฉ ์งˆ๋ฌธ

์•ˆ๋…•ํ•˜์„ธ์š” ์ตœ๊ทผ ๋ทฐ๋ฅผ ๊ณต๋ถ€ํ•˜๋ฉด์„œ grid ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ฐพ๋‹ค๊ฐ€

vue tui grid ์‚ฌ์šฉ์— ๋Œ€ํ•ด์„œ ๊ถ๊ธˆํ•œ ์ ์ด ์žˆ์–ด ์งˆ๋ฌธ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

vue์—์„œ tuiGrid๋ฅผ ์ž„ํฌํŠธํ•œ ๋‹ค์Œ

columns์— formatter ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ์ธํ’‹ ํƒ€์ž…์˜ ๊ทธ๋ฆฌ๋“œ๋‚˜ ๋ฒ„ํŠผ์„ ๋„ฃ์–ด

CRUD ๊ธฐ๋Šฅ์„ ์ปค์Šคํ…€ํ•˜์—ฌ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์ง€๋งŒ github ๋ฌธ์„œ์—์„œ ๋”ฐ๋กœ formatter์— ๊ด€ํ•œ ์˜ต์…˜์ด๋‚˜ ์ž๋ฃŒ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์–ด์„œ

ํ˜น์‹œ ๊ด€๋ จ ์ž๋ฃŒ๋‚˜ ์˜ˆ์ œ ์†Œ์Šค์— ๊ด€ํ•œ ์ •๋ณด๋ฅผ ์•Œ ์ˆ˜ ์žˆ์„๊นŒ์š”?!

`

ref="tuiGrid"
:rowData="rows"
:columnData="columns"
:options="options"
@click="onClick"
@check="onCheck"
@DBLClick="onDoubleClick"
>


<script> import "tui-grid/dist/tui-grid.css"; import { Grid } from "@toast-ui/vue-grid"; import axios from 'axios'; export default { components: { grid: Grid }, data() { return { rows: [ // for rowData prop { name: 'Beautiful Lies', artist: 'Birdy', }, { name: 'X', artist: 'Ed Sheeran' } ], columns: [ // for columnData prop { title: 'Name', name: 'name', }, { title: 'Artist', name: 'artist', formatter : function(){ return ''; }, } ], options: { editingEvent: true, bodyHeight : 500, scrollX: true, scrollY: true, rowHeight: 15, rowHeaders: ["checkbox"] }, dialog: false, selectedRow: null, inputTest: null }; } </script>

`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.