Comments (4)
Maybe the issue is how empty table values are handled in the csvString function:
function csvString(instance, sep, dec) {
var headers = instance.getColHeader();
var csv = headers.join(sep) + "\n";
for (var i = 0; i < instance.countRows(); i++) {
var row = [];
for (var h in headers) {
var col = instance.propToCol(h);
var value = instance.getDataAtRowProp(i, col);
if ( !isNaN(value) ) {
value = value.toString().replace(".", dec);
}
row.push(value);
}
csv += row.join(sep);
csv += "\n";
}
return csv;
}
from rhandsontable.
A simple reprex:
MAT = as.data.frame(matrix(rnorm(50), nrow = 10, dimnames = list(LETTERS[1:10],
letters[1:5])))
MAT$f = NA
rhandsontable(MAT, width = 550, height = 300) %>%
hot_context_menu(
customOpts = list(
csv = list(name = "Download to CSV",
callback = htmlwidgets::JS(
"function (key, options) {
var csv = csvString(this, sep=',', dec='.');
var link = document.createElement('a');
link.setAttribute('href', 'data:text/plain;charset=utf-8,' +
encodeURIComponent(csv));
link.setAttribute('download', 'data.csv');
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}"))))
The reprex is the same code as Export to CSV in the docs, but includes a column that contains all NA values.
from rhandsontable.
Related Issues (20)
- Put in red cells modified
- NULL input for rhandsontable
- using colWidths argument produces duplicate columns HOT 2
- Option to replace the checkbox with fancier shinyWidget item ?
- How to deselect row? HOT 1
- Character column transformed to numeric in hot_to_r
- rhandsontable works locally, but flickering on cloud HOT 2
- Prevent auto arranging rows while editing with column sorting enabled
- Issue when more than 1 character in dropdown
- I did not find any document on Collapsing and expanding rows using rhandsontable in Rshiny. Or Do we even have this functionality? HOT 2
- Borders not updated
- hot_to_r fails to copy date data HOT 6
- Show different colHeaders than are used internally/in the code HOT 1
- Specifying a column type as numericInput with up/down arrows
- Custom dropdown menus
- How to enable paid features - formula support
- Potential conflict with dygraphs, moment.js
- Rhandsontable bouncing when processing a slow calculation
- Added rows repeat row name if initial data has only one row
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rhandsontable.