Most common questions and answers
-
What is the best way to create odd/even rows on a online spreadsheets?
Solution: Adding the following CSS code on your project.
.jexcel tbody tr:nth-child(even) {
background-color: #EEE9F1 !important;
}
-
How to transform multiple HTML static tables in dynamic jspreadsheet tables?
let tables = document.querySelectorAll('table');
for (let i = 0; i < tables.length; i++) {
jspreadsheet(tables[i]);
}
-
How to disable paste over a jspreadsheet spreadsheet?
<script>
jspreadsheet(document.getElementById('spreadsheet'), {
onbeforepaste: function(instance, data, x, y) {
return false;
}
});
</script>
-
How to intercept and change a pasted string over a Jspreadsheet table?
<script>
jspreadsheet(document.getElementById('spreadsheet'), {
onbeforepaste: function(instance, data, x, y) {
data = data.replace(',', '.', data);
return data;
}
});
</script>
-
How to overwrite a type of a cell over a column type?
<script>
jspreadsheet(document.getElementById('spreadsheet'), {
columns: [
{ type: 'text' },
{ type: 'text' },
],
cells: {
B2: { type:'number', mask:'$ #,##0.00', decimal:'.' },
B3: { type:'percent' },
}
});
</script>
NOTE: Only available from Jspreadsheet Pro v7.
6. ### How to disabled the javascript contextmenu of my spreadsheet?
<script>
jspreadsheet(document.getElementById('spreadsheet'), {
columns: [
{ type: 'text' },
{ type: 'text' },
],
contextMenu: function() {
return false;
}
});
</script>
-
How to change the default download filename?
<script>
jspreadsheet(document.getElementById('spreadsheet'), {
csvFileName: 'yourname'
});
</script>
-
How to add an external action without losing the spreadsheet focus?
Working example:
https://jsfiddle.net/spreadsheet/v5tbxg01/
-
How to keep the selection of the spreadsheet clicking in a element outside.
Add a class to the external element: jexcel_object