-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(scrollbar): enhanced verification of the number of columns (#275)
* fix(scrollbar): enhanced verification of the number of columns * fix(colums): support React.Fragment * docs: update examples
- Loading branch information
Showing
12 changed files
with
337 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
### Custom Columns | ||
|
||
<!--start-code--> | ||
|
||
```js | ||
const App = () => { | ||
const [showColumns, setShowColumns] = React.useState(false); | ||
|
||
return ( | ||
<Table | ||
classPrefix="rs-table" | ||
bordered | ||
height={400} | ||
headerHeight={100} | ||
data={fakeDataForColSpan} | ||
> | ||
<Column width={70} align="center" verticalAlign="middle" sortable> | ||
<HeaderCell>Id</HeaderCell> | ||
<Cell dataKey="id" /> | ||
</Column> | ||
|
||
<ColumnGroup | ||
header={'Basic Info'} | ||
align="center" | ||
verticalAlign="middle" | ||
groupHeaderHeight={40} | ||
> | ||
<React.Fragment> | ||
<Column width={120} resizable sortable> | ||
<HeaderCell>firstName</HeaderCell> | ||
<Cell dataKey="firstName" /> | ||
</Column> | ||
|
||
<Column width={120} resizable sortable> | ||
<HeaderCell>lastName</HeaderCell> | ||
<Cell dataKey="lastName" /> | ||
</Column> | ||
</React.Fragment> | ||
|
||
{showColumns ? ( | ||
<Column width={200} resizable sortable> | ||
<HeaderCell>Email</HeaderCell> | ||
<Cell dataKey="email" /> | ||
</Column> | ||
) : null} | ||
</ColumnGroup> | ||
|
||
<React.Fragment> | ||
<Column width={200} verticalAlign="middle" sortable> | ||
<HeaderCell>Company Name</HeaderCell> | ||
<Cell dataKey="companyName" /> | ||
</Column> | ||
|
||
<Column width={200} verticalAlign="middle" sortable> | ||
<HeaderCell>Company Name</HeaderCell> | ||
<Cell dataKey="companyName" /> | ||
</Column> | ||
</React.Fragment> | ||
|
||
<Column width={200} verticalAlign="middle" sortable> | ||
<HeaderCell>Company Name</HeaderCell> | ||
<Cell dataKey="companyName" /> | ||
</Column> | ||
|
||
<Column width={100} resizable colSpan={2} verticalAlign="middle" sortable> | ||
<HeaderCell>City</HeaderCell> | ||
<Cell dataKey="city" /> | ||
</Column> | ||
|
||
{showColumns ? ( | ||
<Column width={100} resizable sortable> | ||
<HeaderCell>Street</HeaderCell> | ||
<Cell dataKey="street" /> | ||
</Column> | ||
) : null} | ||
</Table> | ||
); | ||
}; | ||
|
||
ReactDOM.render(<App />); | ||
``` | ||
|
||
<!--end-code--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.