@@ -28,6 +28,9 @@ export class TableModel implements PaginationModel {
2828 // init rowsContext
2929 this . rowsContext = new Array < string > ( this . _data . length ) ;
3030
31+ // init rowsClass
32+ this . rowsClass = new Array < string > ( this . _data . length ) ;
33+
3134 // only create a fresh header if necessary (header doesn't exist or differs in length)
3235 if ( this . header == null || ( this . header . length !== this . _data [ 0 ] . length && this . _data [ 0 ] . length > 0 ) ) {
3336 let header = new Array < TableHeaderItem > ( ) ;
@@ -86,6 +89,18 @@ export class TableModel implements PaginationModel {
8689 */
8790 rowsContext : Array < string > ;
8891
92+ /**
93+ * Contains class name(s) of the row.
94+ *
95+ * It affects styling of the row to reflect the appended class name(s).
96+ *
97+ * It's empty or undefined by default
98+ *
99+ * @type {Array<string> }
100+ * @memberof TableModel
101+ */
102+ rowsClass : Array < string > ;
103+
89104 /**
90105 * Contains information about the header cells of the table.
91106 *
@@ -296,6 +311,9 @@ export class TableModel implements PaginationModel {
296311
297312 // update rowsContext property for length
298313 this . rowsContext . push ( undefined ) ;
314+
315+ // update rowsClass property for length
316+ this . rowsClass . push ( undefined ) ;
299317 } else {
300318 const ri = this . realRowIndex ( index ) ;
301319 this . data . splice ( ri , 0 , realRow ) ;
@@ -308,6 +326,9 @@ export class TableModel implements PaginationModel {
308326
309327 // update rowsContext property for length
310328 this . rowsContext . splice ( ri , 0 , undefined ) ;
329+
330+ // update rowsClass property for length
331+ this . rowsClass . splice ( ri , 0 , undefined ) ;
311332 }
312333
313334 this . dataChange . emit ( ) ;
@@ -327,6 +348,7 @@ export class TableModel implements PaginationModel {
327348 this . rowsSelected . splice ( rri , 1 ) ;
328349 this . rowsExpanded . splice ( rri , 1 ) ;
329350 this . rowsContext . splice ( rri , 1 ) ;
351+ this . rowsClass . splice ( rri , 1 ) ;
330352
331353 this . dataChange . emit ( ) ;
332354 }
@@ -503,6 +525,10 @@ export class TableModel implements PaginationModel {
503525 const rowContext = new TableItem ( ) ;
504526 rowContext . data = this . rowsContext [ i ] ;
505527 this . data [ i ] . push ( rowContext ) ;
528+
529+ const rowClass = new TableItem ( ) ;
530+ rowClass . data = this . rowsClass [ i ] ;
531+ this . data [ i ] . push ( rowClass ) ;
506532 }
507533 }
508534
@@ -516,6 +542,7 @@ export class TableModel implements PaginationModel {
516542 */
517543 popRowStateFromModelData ( ) {
518544 for ( let i = 0 ; i < this . data . length ; i ++ ) {
545+ this . rowsClass [ i ] = this . data [ i ] . pop ( ) . data ;
519546 this . rowsContext [ i ] = this . data [ i ] . pop ( ) . data ;
520547 this . rowsExpanded [ i ] = ! ! this . data [ i ] . pop ( ) . data ;
521548 this . rowsSelected [ i ] = ! ! this . data [ i ] . pop ( ) . data ;
0 commit comments