Grid theming
by stitot
HTML
<script src="http://localhost:3031/grid/grid-lite.js"></script>
<script src="http://localhost:3031/highcharts.js"></script>
<script src="http://localhost:3031/themes/adaptive.js"></script>
<div id="container">
<div id="table_0" class="table-wrapper"></div>
<div id="table_1" class="table-wrapper"></div>
<div id="table_2" class="table-wrapper"></div>
<div id="table_3" class="table-wrapper"></div>
</div>
<p class="highcharts-description">
The demo shows how Highcharts Grid can be designed with theming, making it
easy to adapt its styles.
</p>
CSS
@import url("http://localhost:3031/grid/css/grid.css");
* {
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
sans-serif;
}
#container {
padding: 12px;
}
.highcharts-description {
padding: 0 20px;
}
.table-wrapper {
margin-bottom: 50px;
height: 350px;
}
/*
* If there are multiple grids on the same page that share some styling it is
* recommended to apply these variables to the outer .hcg-container element.
*/
.hcg-container {
--hcg-caption-font-size: 20px;
--hcg-caption-color: #333;
--hcg-description-font-size: 14px;
--hcg-description-color: #333;
}
/*
* The available CSS variables are for styling the overall grid. If you use
* custom HTML inside grid elements, or you miss some styling options, you can
* always override CSS selectors, or add new ones, using plain CSS. We always
* recommend using the provided CSS variables whenever possible.
*/
.hcg-description {
line-height: 1.5em;
}
.hcg-description code {
font-family: Consolas, "courier new", monospace;
line-height: 1em;
background: #f7f7f7;
border: 1px solid #e1e1e1;
padding: 2px 4px;
border-radius: 5px;
display: inline-block;
}
.theme-compact {
--hcg-font-size: 14px;
--hcg-padding: 7px;
--hcg-header-vertical-padding: 7px;
--hcg-border-radius: 0;
--hcg-row-border-width: 0;
}
.my-theme {
--my-hover-color: #f00;
--hcg-font-size: 15px;
--hcg-color: #666;
--hcg-header-color: #fff;
--hcg-background: #fff;
--hcg-padding: 10px;
--hcg-header-background: #002933;
--hcg-row-even-background: #e9faff;
--hcg-cell-hovered-header-background: #1a3f48;
--hcg-cell-hovered-border-width: 1px;
--hcg-cell-hovered-column-border-width:...
JavaScript
/* eslint-disable max-len */
const { merge } = Grid;
const config = {
dataTable: {
columns: {
firstName: [
'Alice', 'Bob', 'Charlie', 'Diana', 'Evan', 'Fiona', 'George',
'Hannah', 'Ian', 'Julia', 'Kevin', 'Laura', 'Michael', 'Nina',
'Oscar', 'Paula', 'Quincy', 'Rachel', 'Steven', 'Tina'
],
lastName: [
'Smith', 'Johnson', 'Williams', 'Brown', 'Jones', 'Miller',
'Davis', 'Garcia', 'Rodriguez', 'Martinez', 'Hernandez',
'Lopez', 'Gonzalez', 'Wilson', 'Anderson', 'Thomas', 'Taylor',
'Moore', 'Jackson', 'Martin'
],
email: [
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]',
'[email protected]', '[email protected]'
],
age: [
28, 34, 45, 22, 31, 39, 50, 27, 36, 29,
41, 33, 52, 40, 38, 26, 44, 32, 37, 30
],
department: [
'Engineering', 'Marketing', 'Finance', 'HR', 'Operations',
'Sales', 'IT', 'Customer Support', 'Research', 'Development',
'Engineering', 'Marketing', 'Finance', 'HR', 'Operations',
'Sales', 'IT', 'Customer Support', 'Research', 'Development'
]
}
...