Formatting grid's row in Kendo UI for Angular 2 grid

前端 未结 2 1712
野性不改
野性不改 2021-01-29 00:58

I am wondering if there is a way to format the row\'s appearance based on a field\'s value?

Thanks.

2条回答
  •  暖寄归人
    2021-01-29 01:23

    This might be a little too late, but its possible!

    HTML

    How to style based on row:

    
         
         
         
         
         
         
    
    

    How to style based on column:

    
         
         
         
         
          {
      switch (context.dataItem.status) {
          case "STOPPED":
              return "red";
          case "STARTED":
              return "green";
          case "ERROR":
              return "yellow";
          default:
              return {};
      }
    }
    

    Note: ViewEncapsulation.None in order to make this work.

    API: https://www.telerik.com/kendo-angular-ui/components/grid/api/RowClassArgs/

    DEMO

    https://stackblitz.com/edit/angular-tylq1k?file=app/app.component.ts

提交回复
热议问题