Skip to content

Instantly share code, notes, and snippets.

@sbimochan
Last active January 15, 2021 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbimochan/de293bd5477a04a78dd474b07c9d266f to your computer and use it in GitHub Desktop.
Save sbimochan/de293bd5477a04a78dd474b07c9d266f to your computer and use it in GitHub Desktop.
Open all rows of react-table in new tab. Change 7 to number of columns manually. You might get a pop up blocked in url box while running for first time.
function getColumnIndices(total) {
let indices = [];
//7 because number of column is 7
for (let index = 0; index < total; index += 7) {
indices.push(index);
}
return indices;
}
const allColumns = document.getElementsByClassName('rt-td');
const indices = getColumnIndices(allColumns.length);
const rows = indices.map((index) => allColumns[index]);
const evt = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true,
clientX: 20,
ctrlKey: true,
});
rows.forEach((el) => el.dispatchEvent(evt));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment