Spreadsheet layout

Examples

Change the visual style

Currently there are two native layouts: the default and the modern. The latter can be selected by adding the jss_modern class to the spreadsheet DIV container.





JavaScript example

<html>
<script src="https://jspreadsheet.com/v10/jspreadsheet.js"></script>
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v10/jspreadsheet.css" type="text/css" />
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />

<div id="spreadsheet"></div>

<script>
var toggle = function() {
    if (document.getElementById('spreadsheet').classList.contains('jss_modern')) {
        document.getElementById('spreadsheet').classList.remove('jss_modern');
    } else {
        document.getElementById('spreadsheet').classList.add('jss_modern');
    }
}

// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('OWY1ODIzN2VjOTM5NGU0ZjY2ZjFmYmQyMDQ5MTg0MDljZTY4MWY0NzQ3YmE0ZTI1ZTg5ODYyZjk4Y2QzMmY3ZmE1NDdhNDJhZjljYTZiZjA1MmY5Nzk4ZjYyYTU1MjY4NDQzZjJhMDBlNDBiYmMyOWVjZjY3MTgwNGQzM2MwMjgsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UY3dPVEkzTWpRM09Dd2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklsMHNJbVJsYlc4aU9uUnlkV1Y5');

jspreadsheet(document.getElementById('spreadsheet'), {
    worksheets: [
        { minDimensions: [10,10] },
    ]
});
</script>

<button type="button" onclick="toggle()">Toggle skin </button>
</html>

React example

import React, { useRef } from "react";
import { Spreadsheet, Worksheet } from "@jspreadsheet/react";

const license = 'OWY1ODIzN2VjOTM5NGU0ZjY2ZjFmYmQyMDQ5MTg0MDljZTY4MWY0NzQ3YmE0ZTI1ZTg5ODYyZjk4Y2QzMmY3ZmE1NDdhNDJhZjljYTZiZjA1MmY5Nzk4ZjYyYTU1MjY4NDQzZjJhMDBlNDBiYmMyOWVjZjY3MTgwNGQzM2MwMjgsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UY3dPVEkzTWpRM09Dd2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklsMHNJbVJsYlc4aU9uUnlkV1Y5';

const toggle = function() {
    if (document.getElementById('spreadsheet').classList.contains('jss_modern')) {
        document.getElementById('spreadsheet').classList.remove('jss_modern');
    } else {
        document.getElementById('spreadsheet').classList.add('jss_modern');
    }
}

export default function App() {
    // Spreadsheet array of worksheets
    const spreadsheet = useRef();
    // Render component
    return (
        <>
            <Spreadsheet ref={spreadsheet} license={license}>
                <Worksheet />
            </Spreadsheet>
            <button type="button" onClick={() => toggle()}>Toggle</button>
        </>
    );
}

Vue example

<template>
    <Spreadsheet ref="spreadsheet" :license="license">
        <Worksheet />
    </Spreadsheet>
    <button type="button" @click="toggle">Toggle</button>
</template>

<script>
import { Spreadsheet, Worksheet } from "@jspreadsheet/vue";

const license = 'OWY1ODIzN2VjOTM5NGU0ZjY2ZjFmYmQyMDQ5MTg0MDljZTY4MWY0NzQ3YmE0ZTI1ZTg5ODYyZjk4Y2QzMmY3ZmE1NDdhNDJhZjljYTZiZjA1MmY5Nzk4ZjYyYTU1MjY4NDQzZjJhMDBlNDBiYmMyOWVjZjY3MTgwNGQzM2MwMjgsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UY3dPVEkzTWpRM09Dd2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklsMHNJbVJsYlc4aU9uUnlkV1Y5';

export default {
    components: {
        Spreadsheet,
        Worksheet,
    },
    methods: {
        toggle() {
            if (this.$refs.spreadsheet.el.classList.contains('jss_modern')) {
                this.$refs.spreadsheet.el.classList.remove('jss_modern');
            } else {
                this.$refs.spreadsheet.el.classList.add('jss_modern');
            }
        }
    },
    data() {
        return {
            license,
        };
    }
}
</script>

Angular example

import { Component, ViewChild, ElementRef } from "@angular/core";
import * as jspreadsheet from "jspreadsheet";

// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('OWY1ODIzN2VjOTM5NGU0ZjY2ZjFmYmQyMDQ5MTg0MDljZTY4MWY0NzQ3YmE0ZTI1ZTg5ODYyZjk4Y2QzMmY3ZmE1NDdhNDJhZjljYTZiZjA1MmY5Nzk4ZjYyYTU1MjY4NDQzZjJhMDBlNDBiYmMyOWVjZjY3MTgwNGQzM2MwMjgsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UY3dPVEkzTWpRM09Dd2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklsMHNJbVJsYlc4aU9uUnlkV1Y5');

// Create component
@Component({
    selector: "app-root",
    template: `<div #spreadsheet></div>
        <button type="button" (click)="toogle">Toggle</button>`;
})
export class AppComponent {
    @ViewChild("spreadsheet") spreadsheet: ElementRef;
    // Worksheets
    worksheets: jspreadsheet.worksheetInstance[];
    // Create a new data grid
    ngOnInit() {
        // Create spreadsheet
        this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, {
            worksheets: [{ minDimensions: [10,10] }],
        });
    }

    toggle() {
        if (this.spreadsheet.nativeElement.classList.contains('jss_modern')) {
            this.spreadsheet.nativeElement.classList.remove('jss_modern');
        } else {
            this.spreadsheet.nativeElement.classList.add('jss_modern');
        }
    }
}