Customization

Styling

There is a possibility to make changes in the look and feel of a list. For this you need to take the following steps:

  • add a new CSS class(es) with desired settings in the < style > section of your HTML page or in your file with styles (don't forget to include your file on the page in this case):
<style>
    .my-first-class {
        /*some styles*/
    }
 
    .my-second-class {
        /*some styles*/
    }
</style>
  • specify the name of the created CSS class (or names of classes separated by spaces) as the value of the css property in the List configuration:
var list = new dhx.List({ 
    css:"my-first-class my-second-class"
});

Styling items

You can style particular cells in the list. For example, apply some color to each even item, as in:

var list = new dhx.List("list");
list.data.parse(dataset);
 
list.data.map(function (item, i) {
    if (!(i % 2)) {
        list.data.update(item.id, {css: "bg-gray"})
    }
})
 
<style>
    .bg-gray {
        background: #faf9f9;
    }
</style>
Back to top