Skip to content

Instantly share code, notes, and snippets.

@nojaja
Created June 18, 2017 08:19
Show Gist options
  • Select an option

  • Save nojaja/8947a20da4bbdbb255bb8270573f9f23 to your computer and use it in GitHub Desktop.

Select an option

Save nojaja/8947a20da4bbdbb255bb8270573f9f23 to your computer and use it in GitHub Desktop.
React-Handsontable component
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Frontpage layout example - UIkit documentation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.12.0/css/uikit.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-3.0.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handsontable/0.27.0/handsontable.full.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/handsontable/0.27.0/handsontable.full.min.css">
<script src='https://cdnjs.cloudflare.com/ajax/libs/react-router-dom/4.1.1/react-router-dom.min.js'></script>
<script>
const { BrowserRouter, HashRouter, Switch, Route, Link } = ReactRouterDOM;
const ReactLink = ReactRouterDOM.Link;
</script>
</head>
<body>
<div>
<ReactHandsontable id="test" />
</div>
<element name="React-Handsontable">
<script language='es6'>
componentDidMount() {
var $container = $("#"+this.props.id);
$container.handsontable({
startCols: 10,
startRows: 10,
comments: true,
rowHeaders: true,
colHeaders: true,
contextMenu: true
});
// This way, you can access Handsontable api methods by passing their names as an argument, e.g.:
var hotInstance = $container.handsontable('getInstance');
hotInstance.getData()
}
</script>
<template>
<div id={this.props.id} ></div>
</template>
</element>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment