Handsontable example

by handsoncode

HTML

<div id="example"></div>
<script src="https://cdn.jsdelivr.net/npm/handsontable@latest/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@latest/dist/handsontable.full.min.css">

Babel + JSX

function valueToLinkRenderer(instance, td, row, col, prop, value, cellProperties) {
	const linkValue = `<a href="https://www.google.com/search?q=${value}" target="_BLANK">${value}</a>`;
  
  Handsontable.renderers.HtmlRenderer.apply(this, [instance, td, row, col, prop, linkValue, cellProperties]);
}

const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: [
  	['Cell value will be query to Google']
  ],
  licenseKey: 'non-commercial-and-evaluation',
  rowHeaders: true,
  colHeaders: true,
  renderer: valueToLinkRenderer,
});