Switch to handsontable 6.2.2

master
Pete Ley 5 months ago
parent 13d31a484b
commit b422d36885

2
.gitignore vendored

@ -2,5 +2,7 @@ db.sqlite3
__pycache__/
venv/
media/
static/
!*/static/
local.py
*.log

File diff suppressed because one or more lines are too long

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
HostUrl=https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.css

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
HostUrl=https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js

File diff suppressed because one or more lines are too long

@ -1,12 +1,15 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>Editing Takeoff - {{ scope }}</title>
<link rel="stylesheet" href="{% static 'css/handsontable.full.min.css' %}" />
<title>Editing Takeoff {{ scope.name }} - {{ scope.bid }}</title>
<link rel="stylesheet" href="{% static 'css/vendor/handsontable-6.2.2.full.min.css' %}" />
</head>
<body>
<div id="spreadsheet">
<div>
<div id="spreadsheet"
style="height:auto">
</div>
</div>
<div class="controls">
@ -16,10 +19,29 @@
<output id="output"></output>
<script type="text/javascript"
src="{% static 'js/handsontable.full.min.js' %}">
src="{% static 'js/vendor/handsontable-6.2.2.full.min.js' %}">
</script>
<script>
function translateData(data, headers) {
return data.map(function(item) {
var item = item.map((v, i) => [headers[i], v])
return item.reduce(function(data, item) {
if (item[1] && item[1] != ' ') {
data[item[0]] = item[1]
}
return data
}, {})
}).filter(element => {
if (Object.keys(element).length !== 0) {
return true
}
return false
})
}
function translateHeaders(headers) {
return headers.map((x) => x['data'])
}
const container = document.querySelector('#spreadsheet');
const save = document.querySelector('#save');
const output = document.querySelector('#output');
@ -65,30 +87,8 @@
data: {{ scope.takeoff|default_if_none:'[]'|safe }},
columns: columns,
colHeaders: headers,
contextMenu: true,
minSpareRows: 1,
height: 'auto',
licenseKey: 'non-commercial-and-evaluation',
});
function translateData(data, headers) {
return data.map(function(item) {
var item = item.map((v, i) => [headers[i], v])
return item.reduce(function(data, item) {
if (item[1] && item[1] != ' ') {
data[item[0]] = item[1]
}
return data
}, {})
}).filter(element => {
if (Object.keys(element).length !== 0) {
return true
}
return false
})
}
function translateHeaders(headers) {
return headers.map((x) => x['data'])
}
save.addEventListener('click', () => {
// save all cell's data
fetch("{% url 'edit_takeoff' pk=scope.pk %}", {

Loading…
Cancel
Save