Skip to main content

css

Optional. Adds style classes to Grid

css?: string;

Example

<style>
.custom {
--dhx-font-color-primary: #fff;
--dhx-background-primary: #3A434A;
--dhx-s-grid-header-background: #2C3338;

--dhx-border-color: #4A555E;
--dhx-border: var(--dhx-border-width) solid var(--dhx-border-color);
}
</style>

<script>
const grid = new dhx.Grid("grid_container", {
columns: [
{ minWidth: 150, id: "country", header: [{ text: "Country" }] },
{ id: "population", header: [{ text: "Population" }] },
{ id: "yearlyChange", header: [{ text: "Yearly Change" }] },
// more columns
],
adjust: true,
data: dataset,
css: "custom",
});
</script>

Related sample: Grid. Styling (custom CSS)

Note, that the DHTMLX library provides a set of own CSS classes that you can also apply to change the appearance of Grid:

const grid = new dhx.Grid("grid_container", {
css: "dhx_widget--bg_white"
});

Related articles: