Skip to content

Commit 79a5d2a

Browse files
Merge pull request #50 from ShlomoPorges/development
TableGrid work
2 parents adc4151 + 7177908 commit 79a5d2a

File tree

4 files changed

+47
-37
lines changed

4 files changed

+47
-37
lines changed

src/components/DataTable.jsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import TableHead from '@material-ui/core/TableHead';
88
import TableRow from '@material-ui/core/TableRow';
99
import Paper from '@material-ui/core/Paper';
1010
import Button from '@material-ui/core/Button';
11+
import DeleteIcon from '@material-ui/icons/Delete';
12+
import { IconButton } from '@material-ui/core';
13+
1114

1215
const styles = theme => ({
1316
root: {
@@ -16,7 +19,7 @@ const styles = theme => ({
1619
overflowX: 'auto',
1720
},
1821
table: {
19-
minWidth: 700,
22+
minWidth: 500,
2023
},
2124
});
2225

@@ -34,26 +37,33 @@ function dataTable(props) {
3437
if (!row) return;
3538
// for some reason we must put each value in a div.
3639
return rowHeader.map((header, idx) => (
37-
<TableCell key={`td_${idx}`}>
38-
<div>{typeof row[header] === 'string' ? row[header] : row[header].toString()}</div>
40+
<TableCell align={'center'} key={`td_${idx}`}>
41+
{/* <div align={'center'} padding = {'none'} >{typeof row[header] === 'string' ? row[header] : row[header].toString()}</div> */}
42+
{/* {row[header]} */}
43+
{typeof row[header] === 'string' ? row[header] : row[header].toString()}
3944
</TableCell>
4045
));
4146
}
42-
47+
//style={{height: 30}}
4348
const renderRows = rowData.map(row => (
4449
<TableRow key={`row-${row.id}`}>
4550
{renderRowCells(row)}
46-
<TableCell>
47-
<Button onClick={() => deletePropHandler(row.id)}>Delete</Button>
51+
<TableCell align={'center'} padding = {'none'} >
52+
<IconButton color="default" fontSize="small" onClick={() => deletePropHandler(row.id)} >
53+
<DeleteIcon/>
54+
</IconButton>
55+
{/* <Button style={{height: 20}} onClick={() => deletePropHandler(row.id)}>Delete</Button> */}
4856
</TableCell>
4957
</TableRow>
5058
));
5159

5260
return (
5361
<Paper className={classes.root}>
54-
<Table className={classes.table}>
62+
<Table className={classes.table}
63+
selectable = {"true"}
64+
>
5565
<TableHead>
56-
<TableRow>{renderHeader}</TableRow>
66+
<TableRow >{renderHeader}</TableRow>
5767
</TableHead>
5868
<TableBody>{renderRows}</TableBody>
5969
</Table>

src/components/LeftColExpansionPanel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const LeftColExpansionPanel = props => {
1515
const { title, id, color } = component;
1616

1717
function isFocused() {
18-
return focusComponent.title === title ? 'focused' : '';
18+
return focusComponent.id == id ? 'focused' : '';
1919
}
2020

2121
return (

src/components/Props.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ class Props extends Component {
172172
) : (
173173
<Fragment>
174174
<div className="props-container">
175-
<Grid container spacing={16}>
176-
<Grid item xs={5}>
175+
<Grid container spacing={8}>
176+
<Grid item xs={4}>
177177
<form className="props-input" onSubmit={this.handleAddProp}>
178-
<Grid container spacing={24}>
178+
<Grid container spacing={8}>
179179
<Grid item xs={6}>
180180
<TextField
181181
id="propKey"
@@ -255,7 +255,7 @@ class Props extends Component {
255255
</Grid>
256256
</form>
257257
</Grid>
258-
<Grid item xs={11}>
258+
<Grid item xs={8}>
259259
<DataTable rowHeader={rowHeader} rowData={propsRows} deletePropHandler={deleteProp} />
260260
</Grid>
261261
</Grid>

src/components/TableGrid.jsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
import React from 'react';
2-
import ReactDataGrid from 'react-data-grid';
1+
// import React from 'react';
2+
// import ReactDataGrid from 'react-data-grid';
33

4-
function DataGrid() {
5-
const columns = [
6-
{ key: 'idd', name: 'ID' },
7-
{ key: 'title', name: 'Title' },
8-
{ key: 'count', name: 'Count' },
9-
];
4+
// function DataGrid() {
5+
// const columns = [
6+
// { key: 'idd', name: 'ID' },
7+
// { key: 'title', name: 'Title' },
8+
// { key: 'count', name: 'Count' },
9+
// ];
1010

11-
const rows = [
12-
{ idd: 0, title: 'row1', count: 20 },
13-
{ idd: 1, title: 'row1', count: 40 },
14-
{ idd: 2, title: 'row1', count: 60 },
15-
];
11+
// const rows = [
12+
// { idd: 0, title: 'row1', count: 20 },
13+
// { idd: 1, title: 'row1', count: 40 },
14+
// { idd: 2, title: 'row1', count: 60 },
15+
// ];
1616

17-
// console.log(`ract data grid: rows`)
18-
// console.log(rows)
19-
// console.log(`ract data grid: columns`)
20-
// console.log(columns)
17+
// // console.log(`ract data grid: rows`)
18+
// // console.log(rows)
19+
// // console.log(`ract data grid: columns`)
20+
// // console.log(columns)
2121

22-
function getRow(i) {
23-
console.log(`i=${i} rows{i}= ${rows[i]}`);
24-
return rows[i];
25-
}
22+
// function getRow(i) {
23+
// console.log(`i=${i} rows{i}= ${rows[i]}`);
24+
// return rows[i];
25+
// }
2626

27-
return <ReactDataGrid columns={columns} rowGetter={i => rows[i]} rowsCount={2} minHeight={200} />;
28-
}
27+
// return <ReactDataGrid columns={columns} rowGetter={i => rows[i]} rowsCount={2} minHeight={200} />;
28+
// }
2929

30-
export default DataGrid;
30+
// export default DataGrid;

0 commit comments

Comments
 (0)