Back to Use Cases

Project Management Spreadsheet

A simple example including table scripting to perform a photo update and a progress bar added to any new task.

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

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

<script>
let data1 = [
    [ '=B1', '2', 'New products section', '2019-02-12', '80', '=PROGRESS(E1, "darkgreen")' ],
    [ '=B2', '2', 'API integration', '2019-03-01', '100', '=PROGRESS(E2, "darkgreen")' ],
    [ '=B3', '3', 'Deck', '2018-11-10', '30', '=PROGRESS(E3, "darkgreen")' ],
    [ '=B4', '2', 'Prototype', '2019-01-12', '0', '=PROGRESS(E4, "darkgreen")' ],
];

let spreadsheet = jspreadsheet(document.getElementById('spreadsheet'), {
    data:data1,
    columns: [
        { type: 'text', width: '60px', title: 'Photo', readOnly:true },
        { type: 'dropdown', width: '140px', title: 'Name', source: [ { id:'2', name: 'Jorge'}, { id:'7359', name: 'Cosme Sergio' }] },
        { type: 'text', width: '200px', title: 'Task' },
        { type: 'calendar', width: '100px', title: 'When' },
        { type: 'text', width: '50px', title: '%' },
        { type: 'text', width: '100px', title: 'Progress' },
    ],
    allowComments:true,
    updateTable: function(instance, cell, col, row, val, label, cellName) {
        if (col == 0) {
            if (instance.jexcel.options.data[row][col+1]) {
                cell.innerHTML = '<img src="/templates/default/img/' + instance.jexcel.options.data[row][col+1] + '.jpg" style="width:24px;border-radius:16px">';
            } else {
                cell.innerHTML = '<img src="/templates/default/img/nophoto.jpg" style="width:24px;border-radius:16px">';
            }
        }
    },
    license: 'NGYxZTdjYzJhODQxYzcxODRhYjFjOGY4NTIwZTdkYjBiNDhiZTYxYWJlNjI4NWRmMmVkMTBmYzIzNDUyYjRiZTJkY2NiMGUzNjc2ODFhYTRkOWZkNWExNTBjMGQ4NjZiM2EwZWUwNGJhY2UzNmNhMjBiOTIyZjVhYTZjMTg0NmYsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpJNE1qazFORGM1TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==',
});
</script>
</html>