Jspreadsheet with Angular
Click here to see the project running on codesandbox.
Source code
import { Component, ViewChild, ElementRef } from "@angular/core";
import * as jspreadsheet from "jspreadsheet-ce";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
@ViewChild("spreadsheet") spreadsheet: ElementRef;
title = "CodeSandbox";
ngAfterViewInit() {
jspreadsheet(this.spreadsheet.nativeElement, {
data: [[]],
columns: [
{ type: "dropdown", width: "100px", source: ["Y", "N"] },
{ type: "color", width: "100px", render: "square" }
],
minDimensions: [10, 10]
});
}
}
NOTE: Make sure to import the jexcel.css in your angular.json
"styles": ["styles.css","./node_modules/jspreadsheet/dist/jexcel.css"],