Most common questions and answers


  1. What is the best way to create odd/even rows on a Jspreadsheet spreadsheet and tables?

    Solution: Adding the following CSS code on your project.

    .jexcel tbody tr:nth-child(even) {
      background-color: #EEE9F1 !important;
    }
    

  2. How to transform multiple HTML static tables in dynamic Jspreadsheet tables?

    var tables = document.querySelectorAll('table');
    for (var i = 0; i < tables.length; i++) {
        jspreadsheet(tables[i]);
    }
    

  3. How to disable paste over a Jspreadsheet spreadsheet?

    jspreadsheet(document.getElementById('spreadsheet'), {
        onbeforepaste: function(instance, data, x, y) {
            return false;
        }
    });
    

  4. How to intercept and change a pasted string over a Jspreadsheet table?

    jspreadsheet(document.getElementById('spreadsheet'), {
        onbeforepaste: function(instance, data, x, y) {
            data = data.replace(',', '.', data);
            return data;
        }
    });
    

  5. How to overwrite a type of a cell over a column type?

    jspreadsheet(document.getElementById('spreadsheet'), {
        columns: [
            { type: 'text' },
            { type: 'text' }, 
        ],
        cells: {
            B2: { type:'number', mask:'$ #,##.00', decimal:'.' },
            B3: { type:'percent' },
        }
    });
    
    NOTE: Only available on the Pro distribution.

  6. How to disabled the javascript contextmenu of my spreadsheet?

    jspreadsheet(document.getElementById('spreadsheet'), {
        columns: [
            { type: 'text' },
            { type: 'text' }, 
        ],
        contextMenu: function() {
            return false;
        }
    });