How to correctly install Handsontable with RuleJS

2019-09-03 22:53发布

I need to install Handsontable with RuleJS support (for formulas) locally (i.e. not just access its files from github), under Windows. I will later need to distribute with my application. I really do not want to have to install & configure bower, git etc.

Initially, starting from https://github.com/handsontable, I tried downloading the zip from https://github.com/handsontable/handsontable. Then I had to fetch various extra bits from elsewhere on github, attempting to make the demo at http://handsontable.github.io/handsontable-ruleJS/ work. This includes its stuff via:

<!-- handsontable v1 -->
<script data-jsfiddle="common" src="lib/handsontable/handsontable.full.js"></script>
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="lib/handsontable/handsontable.full.css">

<!-- ruleJS -->
<link rel="stylesheet" media="screen" href="lib/handsontable/handsontable.formula.css">

<script data-jsfiddle="common" src="lib/RuleJS/lib/lodash/lodash.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/lib/underscore.string/underscore.string.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/lib/moment/moment.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/lib/numeral/numeral.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/lib/numericjs/numeric.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/lib/js-md5/md5.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/lib/jstat/jstat.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/lib/formulajs/formula.js"></script>

<script data-jsfiddle="common" src="lib/RuleJS/js/parser.js"></script>
<script data-jsfiddle="common" src="lib/RuleJS/js/ruleJS.js"></script>

<script data-jsfiddle="common" src="lib/handsontable/handsontable.formula.js"></script>

This is all messy, and (I think) I could not even find the numericjs/numeric.js in any download package.

I then noticed https://github.com/handsontable/handsontable-ruleJS. This seemed much simpler: it has the handsontable stuff it wants in its own bower_components sub-directory, and its index.html example, with files included via:

<!-- handsontable --> 
<script data-jsfiddle="common" src="bower_components/handsontable/dist/handsontable.full.js"></script> 
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="bower_components/handsontable/dist/handsontable.full.css"> 

<!-- ruleJS --> 
<script data-jsfiddle="common" src="bower_components/ruleJS/dist/full/ruleJS.all.full.js"></script> 
<script data-jsfiddle="common" src="src/handsontable.formula.js"></script> 
<link rel="stylesheet" media="screen" href="src/handsontable.formula.css"> 

Additionally, its README.md states Important: Few things have been modified in external libraries, so please use all library files only from this repo., which makes it sound like this is the safest way to go (and full, latest handsontable release might not even behave correctly).

However, I have just realised that handsontable-RuleJS has its included Handsontable stuff at version 0.14.1, while the latest release of that is 0.23, and there are functions I need from later versions.

So, is there a simple way to download what I need? Should I be using the simple handsontable-RuleJS link, with its included bower_components, or are they only there for the index.html demo, or overwrite them with newer versions, or what...? Or, do I really need to get bower & git, make them work right under Windows, and then magically everything will be sorted out in a way too difficult to just download directly?

1条回答
别忘想泡老子
2楼-- · 2019-09-03 23:22

All I did was use https://github.com/handsontable/ruleJS as it was really simple. I took the files I needed for my project and left the rest of it alone. I would just use this and see what functionalities you need from later versions. Then you can go back and include those. I don't think there is any magical download that will just give you everything you need. You will probably need to play around a little but I don't believe you will need bower and git.

查看更多
登录 后发表回答