Examples
Custom column type
A very powerful feature on jspreadsheet is give developers the hability to create their own custom columns. The following example shows how to integrate a thirdy party clock plugin as a custom column on Jspreadsheet Pro v7+.
A time custom column based on the clockpicker plugin by weareoutman.
Source code
<html> <script src="https://jspreadsheet.com/v7/jspreadsheet.js"></script> <script src="https://jsuites.net/v4/jsuites.js"></script> <link rel="stylesheet" href="https://jspreadsheet.com/v7/jspreadsheet.css" type="text/css" /> <link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" /> <link rel="stylesheet" type="text/css" href="http://weareoutman.github.io/clockpicker/dist/jquery-clockpicker.min.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="http://weareoutman.github.io/clockpicker/dist/jquery-clockpicker.min.js"></script> <div id="custom"></div> <script> var clockEditor = function() { var methods = {}; methods.createCell = function(cell, value, x, y, instance, options) { cell.innerHTML = value; } methods.updateCell = function(cell, value, x, y, instance, options) { if (cell) { cell.innerHTML = value; } } methods.openEditor = function(cell, value, x, y, instance, options) { // Create input from the helpers var editor = jspreadsheet.helpers.createEditor('input', cell); editor.value = value; // Instance of the clock picker $(editor).clockpicker({ afterHide:function() { setTimeout(function() { // To avoid double call if (cell.children[0]) { instance.closeEditor(cell, true); } }); } }); editor.focus(); } methods.closeEditor = function(cell, save) { if (save) { cell.innerHTML = cell.children[0].value; } else { cell.innerHTML = ''; } return cell.innerHTML; } return methods; }(); var data = [ ['PHP', '14:00'], ['Javascript', '16:30'], ]; jspreadsheet(document.getElementById('custom'), { data: data, columns: [ { type: 'text', title: 'Course Title', width: '300px' }, { type: clockEditor, title: 'Time', width: '200px' }, ], license: 'Y2VjYTY3Y2VhMWY3ZjVmYzMwNjk5NTI5NjFlM2U1ZjdlYjI5NjY2MTExY2E5YTA2YTBjYzhmYjc0ODI5NjBmOGI0YWRlYjQ1N2Y4ZGNjNGMwNjYwYzdhNWQ5MDEwMGRiZmE1MmMzYjJlYTU5NDgxNWY4YjY5YTc3M2E3MmUxNGUsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UWTNOakF3TURrM01Td2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWJHOWpZV3hvYjNOMElsMHNJbkJzWVc0aU9pSXpJaXdpYzJOdmNHVWlPbHNpZGpjaUxDSjJPQ0lzSW5ZNUlpd2lZMmhoY25Seklpd2labTl5YlhNaUxDSm1iM0p0ZFd4aElpd2ljR0Z5YzJWeUlpd2ljbVZ1WkdWeUlpd2lZMjl0YldWdWRITWlMQ0pwYlhCdmNuUWlMQ0ppWVhJaUxDSjJZV3hwWkdGMGFXOXVjeUlzSW5ObFlYSmphQ0pkTENKa1pXMXZJanAwY25WbGZRPT0=', }); </script> </html>