import Dom from '../dom'; export class AlternateRows{ /** * Alternating rows color * @param {Object} tf TableFilter instance */ constructor(tf) { var f = tf.config(); //defines css class for even rows this.evenCss = f.even_row_css_class || 'even'; //defines css class for odd rows this.oddCss = f.odd_row_css_class || 'odd'; this.tf = tf; } /** * Sets alternating rows color */ init() { var tf = this.tf; if(!tf.hasGrid() && !tf.isFirstLoad){ return; } var validRowsIndex = tf.validRowsIndex; var noValidRowsIndex = validRowsIndex===null; //1st index var beginIndex = noValidRowsIndex ? tf.refRow : 0; // nb indexes var indexLen = noValidRowsIndex ? tf.nbFilterableRows+beginIndex : validRowsIndex.length; var idx = 0; //alternates bg color for(var j=beginIndex; j