playing with jspreadsheet

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-03-20 08:26:45 +01:00
parent 62981b22b5
commit a2e2643020
4 changed files with 102 additions and 20 deletions

View File

@@ -2,26 +2,36 @@
import { onMount } from 'svelte';
import jspreadsheet from "jspreadsheet-ce";
import "jspreadsheet-ce/dist/jspreadsheet.css";
//import 'jsuites/dist/jsuites.min.css'; // required UI styles
function load(){
jspreadsheet(document.getElementById('spreadsheet'), {
worksheets: [{
data: [
["1","Sum of A:","=SUM(A1:A99)"],
["2"],
["3"],
["4"]
],
columns: [
{ type: 'autonumber', title: 'amount' },
{ type: 'text', width: '350px', title: 'description', align: 'right' },
{ type: 'text', width: '250px', title: 'value' },
],
// Name of the worksheet
worksheetName: 'Albums'
}]
});
var spreadsheet = null;
function update(instance, cell, x, y, value) {
console.log({instance,cell,x,y,value});
console.log(spreadsheet[0].getData());
}
const config = {
worksheets: [{
data: [
["1","Sum of A:","=SUM(A1:A99)"],
["2"],
["3"],
["4"]
],
columns: [
{ type: 'autonumber', title: 'amount' },
{ type: 'text', width: '350px', title: 'description', align: 'right' },
{ type: 'text', width: '250px', title: 'value' },
],
// Name of the worksheet
worksheetName: 'Albums'
}],
onchange: update
};
function load(){
spreadsheet = jspreadsheet(document.getElementById('spreadsheet'), config);
}
onMount(load);