Tag: handontable

自定义渲染器function无法在handsontable插件中工作

我有一个函数来处理一些onChange事件并且运行良好。 该函数调用另一个函数来检查单元格的内容,如果有错误则应该更改单元格颜色。 function Check(x, y) { var content = $editorTableContainer.handsontable(‘getDataAtCell’, y, x); var split = content.split(‘ ‘); $.each(split, function (key, value) { $.get(‘check.php?word=’ + value, function (data) { //blank if no error otherwise it returns an array of suggestions (only need to check if there is an error) if (data) { alert(“test”); var meta = […]

Handsontable Limit Cell Characters

我一直在寻找一个非常简单的问题的答案,如何阻止用户将250个字符输入到Handsontable的单元格中? 我发现我可以重新创建validation,但这不会阻止用户输入超过250个字符。 我正在寻找像maxlength这样的东西: var date_validator_regexp = /(^$|^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/][0-9]{4}$)/; var limit_validator_regexp = /(^[\s\S]{0,250}$)/; $(“#gridUpdateNotes”).handsontable({ startRows: 1, startCols: 2, colHeaders: [“Date”, “Notes”], columnSorting: false, enterBeginsEditing: false, autoWrapRow: true, autoWrapCol: true, minSpareRows: 1, colWidths: [140, 450], removeRowPlugin: true, copyPaste: true, afterValidate: function (isValid, value, row, prop, source) { if (isValid == false && prop === “Notes”) { alert(“The Notes […]

Handsontable保存公式值

我希望将handontable集成到我的网站,但是有一个问题,当我试图保存由RuleJS(公式支持)创建的数据时,脚本给我一个像(= $ A1 * $ B1)的公式。 我试图得到简单数学的结果乘以价格和货币。 如何保存表值,而不是来自sourse? workig代码在jsfiddle: http : //jsfiddle.net/zetwin/qhjuuk5j/4/ document.addEventListener(“DOMContentLoaded”, function() { var people = [ {base_price :’99’, price:’13’, unit:’=A1*B1′}, {base_price :’89.99′, price:’13.43′, unit:’=A2*B2′} ], example1 = document.getElementById(‘example1’), settings1; settings1 = { data: people, formulas: true, rowHeaders: true, colHeaders: true, colHeaders: [ ‘Price’, ‘Currency’, ‘USD’], columns: [ {data: ‘base_price’}, {data: ‘price’}, {data: […]

如何为Handsontable创建动态列?

我正在使用Handsontable创建一个可以在web和excel之间复制/粘贴的网格,我尝试使用下面的代码,它工作正常: var first = true; var exampleGrid = $(“#exampleGrid”); exampleGrid.handsontable({ rowHeaders: true, colHeaders: true, stretchH: ‘all’, minSpareCols: 0, minSpareRows: 0, height: 600, columns: [ { data: “Id”, title: “ID”, type: “text” }, //’text’ is default, you don’t actually have to declare it { data: “Name”, title: “Name”, type: “text” }, { data: “DisplayColor”, title: “Display […]