JSFiddle - React, Tailwind, and code Playground

by Vignesh Gopalakrishnan

JavaScript

let formattedRowId = '006EI4YZIPZ9JGTGZDTGH6HPI';
let rowToBeFormattedId = '006EI4YZIPZ9JGTGZDTGH6BDY';
let allRows = $('.ag-center-cols-clipper .ag-center-cols-viewport .ag-center-cols-container')[0].children;
window.formattedRow = new Map();
for (eachRow of allRows) {
  let formattedRow = null,
    rowToBeFormatted = null;
  for (eachCol of eachRow.children) {
    if (eachCol.attributes['col-id'].value == formattedRowId) {
    	formattedRow = eachCol.style.backgroundColor;
    } else if (eachCol.attributes['col-id'].value == rowToBeFormattedId) {
      rowToBeFormatted = eachCol;
    }
  }
  if (rowToBeFormatted && rowToBeFormatted.style){
  		window.formattedRow.set(rowToBeFormatted, formattedRow);
  } 
}

for (eachRow of allRows) {
  let formattedRow = null,
    rowToBeFormatted = null;
  for (eachCol of eachRow.children) {
    if (eachCol.attributes['col-id'].value == rowToBeFormattedId) {
      rowToBeFormatted = eachCol;
    }
  }
  if (rowToBeFormatted && rowToBeFormatted.style){
  	rowToBeFormatted.style.backgroundColor = window.formattedRow.get(rowToBeFormatted);
  } 
}