title: How to add ngClass type functionality to a row of Primeng p-datatable
body: <p>I have been using Primeng for a while. </p>
  
  <p>I have used Primeng Datatable (p-dataTable) in my component. The component what I am trying to do is inbox. I read messages from DB to a model named 'Message' in Angular 2. There is a field in model named Read. Its used as a flag. Its Boolean. My requirement is if Read is false, entire row elements should be in one colour, say color1. If Read is true, entire row elements should be another color, say color2.</p>
  
  <p>I know how to do the same using ngClass.
   </p>
  
  <p>Can someone please suggest me how I can do the same using p-dataTable. I tried many ways I can by referring many sites &amp; didn't find any. <strong>What I want is a functionality similar to ngClass in p-dataTable</strong></p>
  
  <p>Here is my code</p>
  
  <p><strong>In HTML</strong></p>
  
  <pre><code>&lt;p-dataTable [rowStyleClass]="readFlag" [value]="message" &gt;
          &lt;p-column [style]="{'width':'38px'}"  selectionMode="multiple"&gt;&lt;/p-column&gt;
          &lt;p-column field="SenderUserId"  header="From" [sortable]="true"&gt;&lt;/p-column&gt;
          &lt;p-column class="icon-mandatory" field="Subject" header="Message"&gt;&lt;/p-column&gt;
          &lt;p-column field="MessageDate" header="Time" [sortable]="true"&gt;
              &lt;template let-col let-message="rowData" pTemplate type="body"&gt;
                  &lt;span&gt;{{message.MessageDate | date: 'medium'}}&lt;/span&gt;
              &lt;/template&gt;
          &lt;/p-column&gt;
  &lt;/p-dataTable&gt;
  </code></pre>
  
  <p><strong>In Component</strong></p>
  
  <pre><code>readFlag(rowData: Message) { return rowData.Read ? 'inbox-Read' : 'inbox-Unread' ; } 
  </code></pre>
  
  <p><strong>Message Model</strong></p>
  
  <pre><code>export class Message 
  {
      public Subject: string;
      public Body: string;
      public MessageDate: any;
      public Read: boolean;
  }
  </code></pre>