import {Feature} from './feature'; import Dom from '../dom'; export class AlternateRows extends Feature { /** * Alternating rows color * @param {Object} tf TableFilter instance */ constructor(tf) { super(tf, 'alternateRows'); var config = this.config; //defines css class for even rows this.evenCss = config.even_row_css_class || 'even'; //defines css class for odd rows this.oddCss = config.odd_row_css_class || 'odd'; } /** * Sets alternating rows color */ init() { if(this.initialized){ return; } var tf = this.tf; 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