-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathindex.js
More file actions
137 lines (127 loc) · 5.17 KB
/
index.js
File metadata and controls
137 lines (127 loc) · 5.17 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import React, {useState} from "react";
import ReactDOM from "react-dom";
import MUIDataTable from "../../src/";
import InputLabel from '@mui/material/InputLabel';
import MenuItem from '@mui/material/MenuItem';
import FormHelperText from '@mui/material/FormHelperText';
import FormControl from '@mui/material/FormControl';
import Select from '@mui/material/Select';
import TextField from '@mui/material/TextField';
function Example() {
const [responsive, setResponsive] = useState("vertical");
const [tableBodyHeight, setTableBodyHeight] = useState("400px");
const [tableBodyMaxHeight, setTableBodyMaxHeight] = useState("");
const [transitionTime, setTransitionTime] = useState(300);
const [selectableRows, setSelectableRows] = useState('none');
const [treeData, setTreeData] = useState([
{ title: 'Chicken', children: [{ title: 'Egg' }] },
{ title: 'Fish', children: [{ title: 'fingerline'}] }
]);
const columns = [{
name: 'hidden',
options: {
display: 'excluded'
}
},"Name", "Title", "Location", {
name: 'No Drag',
options: {
draggable: false,
}
}, "Phone"];
const options = {
filter: true,
filterType: 'dropdown',
responsive,
tableBodyHeight,
tableBodyMaxHeight,
draggableColumns: {
enabled: true,
transitionTime
},
selectableRows: selectableRows,
};
const data = [
["1","Gabby George", "Business Analyst", "Minneapolis","1","555-1234"],
["1","Aiden Lloyd", "Business Consultant for an International Company and CEO of Tony's Burger Palace", "Dallas","2","555-1234"],
["1","Jaden Collins", "Attorney", "Santa Ana","1","555-5555"],
["1","Franky Rees", "Business Analyst", "St. Petersburg","1","555-3333"],
["1","Aaren Rose", null, "Toledo","1","555-4444"],
["1","Johnny Jones", "Business Analyst", "St. Petersburg","3","555-2468"],
["1","Jimmy Johns", "Business Analyst", "Baltimore","1","555-1357"],
["1","Jack Jackson", "Business Analyst", "El Paso","1","555-4321"],
["1","Joe Jones", "Computer Programmer", "El Paso","1","555-4321"],
["1","Jacky Jackson", "Business Consultant", "Baltimore","4","555-1234"],
["1","Jo Jo", "Software Developer", "Washington DC","4","555-1122"],
["1","Donna Marie", "Business Manager", "Annapolis","5","555-5555"],
];
return (
<>
<FormControl>
<InputLabel id="demo-simple-select-label">Responsive Option</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={responsive}
style={{width:'200px', marginBottom:'10px', marginRight:10}}
onChange={(e) => setResponsive(e.target.value)}
>
<MenuItem value={"vertical"}>vertical</MenuItem>
<MenuItem value={"standard"}>standard</MenuItem>
<MenuItem value={"simple"}>simple</MenuItem>
<MenuItem value={"scroll"}>scroll (deprecated)</MenuItem>
<MenuItem value={"scrollMaxHeight"}>scrollMaxHeight (deprecated)</MenuItem>
<MenuItem value={"stacked"}>stacked (deprecated)</MenuItem>
</Select>
</FormControl>
<FormControl>
<InputLabel id="demo-simple-select-label">Table Body Height</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={tableBodyHeight}
style={{width:'200px', marginBottom:'10px', marginRight:10}}
onChange={(e) => setTableBodyHeight(e.target.value)}
>
<MenuItem value={""}>[blank]</MenuItem>
<MenuItem value={"400px"}>400px</MenuItem>
<MenuItem value={"800px"}>800px</MenuItem>
<MenuItem value={"100%"}>100%</MenuItem>
</Select>
</FormControl>
<FormControl>
<InputLabel id="demo-simple-select-label">Max Table Body Height</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={tableBodyMaxHeight}
style={{width:'200px', marginBottom:'10px',marginRight:10}}
onChange={(e) => setTableBodyMaxHeight(e.target.value)}
>
<MenuItem value={""}>[blank]</MenuItem>
<MenuItem value={"400px"}>400px</MenuItem>
<MenuItem value={"800px"}>800px</MenuItem>
<MenuItem value={"100%"}>100%</MenuItem>
</Select>
</FormControl>
<FormControl>
<InputLabel id="demo-simple-select-label">Selectable Rows:</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={selectableRows}
style={{width:'200px', marginBottom:'10px',marginRight:10}}
onChange={(e) => setSelectableRows(e.target.value)}
>
<MenuItem value={"none"}>none</MenuItem>
<MenuItem value={"single"}>single</MenuItem>
<MenuItem value={"multiple"}>multiple</MenuItem>
</Select>
</FormControl>
<FormControl>
<TextField label="Transition Time" type="number" value={transitionTime} onChange={(e) => setTransitionTime(e.target.value)} />
</FormControl>
<MUIDataTable title={"ACME Employee list"} data={data} columns={columns} options={options} />
</>
);
}
export default Example;