Most common questions and answers


  1. The Jspreadsheet transform a string in a number.

  2. This is because the autoCasting is set as default. It tries to improve the calculations converting string to number. Solution: autoCasting: false as a property in the column definitions.

    ...
    columns: [{
        type:'text', autoCasting: false
    }]
    
  3. What is the best way to create odd/even rows on a online spreadsheets?

  4. Solution: Adding the following CSS code on your project.

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

  5. How to transform multiple HTML static tables in dynamic jspreadsheet tables?

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

  7. How to disable paste over a jspreadsheet spreadsheet?

  8. jspreadsheet(document.getElementById('spreadsheet'), {
        worksheets: [{
            minDimensions: [6,6],
        }],
        onbeforepaste: function(instance, data, x, y) {
            return false;
        }
    });
    

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

  10. jspreadsheet(document.getElementById('spreadsheet'), {
        worksheets: [{
            minDimensions: [6,6],
        }],
        onbeforepaste: function(instance, data, x, y) {
            data = data.replace(',', '.', data);
            return data;
        }
    });
    

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

  12. jspreadsheet(document.getElementById('spreadsheet'), {
        worksheets: [{
            columns: [
                { type: 'text' },
                { type: 'text' }, 
            ],
            cells: {
                B2: { type:'number', mask:'$ #,##0.00', decimal:'.' },
                B3: { type:'percent' },
            }
        }
    });
    
    NOTE: Only available from Jspreadsheet Pro v7.

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

  14. jspreadsheet(document.getElementById('spreadsheet'), {
        worksheets: [{
            columns: [
                { type: 'text' },
                { type: 'text' }, 
            ],
            cells: {
                B2: { type:'number', mask:'$ #,##0.00', decimal:'.' },
                B3: { type:'percent' },
            }
        },
        contextMenu: function() {
            return false;
        }
    });
    


  15. How to change the default download filename?

  16. jspreadsheet(document.getElementById('spreadsheet'), {
        csvFileName: 'yourname'
    });
    


  17. How to add an external action without losing the spreadsheet focus?

  18. Working example:

    https://jsfiddle.net/spreadsheet/v5tbxg01/


  19. How to keep the selection of the spreadsheet clicking in a element outside.

  20. Add a class to the external element: jss_object