forked from felixrieseberg/React-Spreadsheet-Component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
65 lines (59 loc) · 1.82 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import React from 'react';
import ReactDOM from 'react-dom';
import Spreadsheet from './lib/spreadsheet';
// Example One
let exampleOne = {};
exampleOne.initialData = {
rows: [
['', '', '', '', '', '', '', ''],
['', 1, 2, 3, 4, 5, 6, 7],
['', 1, '', 3, 4, 5, 6, 7],
['', 1, 2, 3, 4, 5, 6, 7],
['', 1, 2, 3, 4, 5, 6, 7]
]
};
exampleOne.config = {
rows: 5,
columns: 8,
hasHeadColumn: true,
isHeadColumnString: true,
hasHeadRow: true,
isHeadRowString: true,
canAddRow: true,
canAddColumn: true,
emptyValueSymbol: '-',
hasLetterNumberHeads: true
};
// Example Two
let exampleTwo = {};
exampleTwo.initialData = {
rows: [
['Customer', 'Job', 'Contact', 'City', 'Revenue'],
['iDiscovery', 'Build', 'John Doe', 'Boston, MA', '500,000'],
['SxSW', 'Build', 'Tom Fuller', 'San Francisco, CA', '600,000'],
['CapitalTwo', 'Failed', 'Eric Pixel', 'Seattle, WA', '450,000']
]
};
exampleTwo.cellClasses = {
rows: [
['', '', '', '', '', '', '', ''],
['green', '', '', '', '', '', '', 'dollar'],
['purple', '', '', '', '', '', '', 'dollar'],
['yellow', 'failed', '', '', '', '', '', 'dollar'],
]
};
exampleTwo.config = {
rows: 5,
columns: 5,
headColumn: true,
headColumnIsString: true,
headRow: true,
headRowIsString: true,
canAddRow: false,
canAddColumn: false,
emptyValueSymbol: '-',
letterNumberHeads: false
};
// Render
ReactDOM.render(<Spreadsheet initialData={exampleOne.initialData} config={exampleOne.config} cellClasses={exampleOne.cellClasses} />, document.getElementById('exampleOne'));
ReactDOM.render(<Spreadsheet initialData={exampleTwo.initialData} config={exampleTwo.config} cellClasses={exampleTwo.cellClasses} />, document.getElementById('exampleTwo'));