This repository was archived by the owner on Oct 24, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +57
-52
lines changed Expand file tree Collapse file tree 2 files changed +57
-52
lines changed Original file line number Diff line number Diff line change 22 <div class =" container" >
33 <h1 >🍞🔡 TOAST UI Grid + Vue</h1 >
44 <grid
5- :rowData =" data"
6- :columnData =" columns"
7- :options =" options"
5+ :rowData =" options.data"
6+ :columnData =" options.columns"
7+ :options =" options.options"
8+ :theme =" options.myTheme"
89 @check =" onCheck"
910 @uncheck =" onUnCheck"
1011 ></grid >
1112 </div >
1213</template >
1314<script >
15+ import ' tui-grid/dist/tui-grid.css' ;
1416import {Grid } from ' ../src/index.js' ;
1517
1618export default {
1719 components: {
1820 grid: Grid
1921 },
20- data () {
21- return {
22+ created () {
23+ this . options = {
2224 columns: [
2325 {
24- title: ' Name' ,
25- name: ' name'
26+ header: ' Name' ,
27+ name: ' name' ,
28+ editor: ' text'
2629 },
2730 {
28- title : ' Artist' ,
31+ header : ' Artist' ,
2932 name: ' artist'
3033 },
3134 {
32- title : ' Personal Score' ,
35+ header : ' Personal Score' ,
3336 name: ' score' ,
3437 onBeforeChange (ev ) {
3538 console .log (' executes before the value changes : ' , ev);
@@ -40,31 +43,32 @@ export default {
4043 copyOptions: {
4144 useListItemText: true
4245 },
43- editOptions : {
46+ editor : {
4447 type: ' radio' ,
45- listItems: [
46- {
47- text: ' ★☆☆☆☆' ,
48- value: ' 1'
49- },
50- {
51- text: ' ★★☆☆☆' ,
52- value: ' 2'
53- },
54- {
55- text: ' ★★★☆☆' ,
56- value: ' 3'
57- },
58- {
59- text: ' ★★★★☆' ,
60- value: ' 4'
61- },
62- {
63- text: ' ★★★★★' ,
64- value: ' 5'
65- }
66- ],
67- useViewMode: true
48+ options: {
49+ listItems: [
50+ {
51+ text: ' ★☆☆☆☆' ,
52+ value: ' 1'
53+ },
54+ {
55+ text: ' ★★☆☆☆' ,
56+ value: ' 2'
57+ },
58+ {
59+ text: ' ★★★☆☆' ,
60+ value: ' 3'
61+ },
62+ {
63+ text: ' ★★★★☆' ,
64+ value: ' 4'
65+ },
66+ {
67+ text: ' ★★★★★' ,
68+ value: ' 5'
69+ }
70+ ]
71+ }
6872 }
6973 }
7074 ],
@@ -120,12 +124,24 @@ export default {
120124 score: ' 5'
121125 }
122126 ],
123- options: {
124- rowHeaders: [
125- {
126- type: ' checkbox'
127+ rowHeaders: [' checkbox' ],
128+ myTheme: {
129+ name: ' myTheme' ,
130+ value: {
131+ cell: {
132+ normal: {
133+ background: ' #00ff00' ,
134+ border: ' #e0e0e0'
135+ },
136+ header: {
137+ background: ' #ff0000' ,
138+ border: ' #ffff00'
139+ },
140+ editable: {
141+ background: ' #fbfbfb'
142+ }
127143 }
128- ]
144+ }
129145 }
130146 };
131147 },
Original file line number Diff line number Diff line change @@ -8,13 +8,10 @@ const gridEvents = [
88 ' beforeRequest' ,
99 ' check' ,
1010 ' click' ,
11- ' collapsed' ,
12- ' collapsedAll' ,
11+ ' collapse' ,
1312 ' dblclick' ,
14- ' deleteRange' ,
1513 ' errorResponse' ,
16- ' expanded' ,
17- ' expandedAll' ,
14+ ' expand' ,
1815 ' failResponse' ,
1916 ' focusChange' ,
2017 ' mousedown' ,
@@ -79,14 +76,6 @@ export default {
7976 gridInstance: null
8077 };
8178 },
82- watch: {
83- rowData (newData ) {
84- this .invoke (' setData' , newData);
85- },
86- columnData (newColumns ) {
87- this .invoke (' setColumns' , newColumns);
88- }
89- },
9079 mounted () {
9180 const options = Object .assign ({}, this .options , {
9281 el: this .$refs .tuiGrid ,
@@ -131,7 +120,7 @@ export default {
131120 },
132121 invoke (methodName , ... args ) {
133122 let result;
134- if (( methodName === ' setData ' || methodName === ' resetData' ) && args .length > 0 ) {
123+ if (methodName === ' resetData' && args .length > 0 ) {
135124 const clonedData = JSON .parse (JSON .stringify (args[0 ]));
136125 if (args .length > 1 ) {
137126 this .gridInstance [methodName](clonedData, args[1 ]);
You can’t perform that action at this time.
0 commit comments