-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: formatting #121
feature: formatting #121
Conversation
Created a way to format cells. Added default formatting types of boolean, currency, date, number, and time. Created a demo with multiple formats used and added documentation for the feature.
Thanks @jayden-emergence . This is definitely useful and clever. I just have some questions. Why did you decide to format the values in |
I decided to do it this way for a couple reasons. Firstly I didn't have time to figure out the best way. And secondly I did some testing in excel 2007 to see what it does. If you type in excel the following: Format the first cell to Number with 2 decimal places and the second cell to currency you will then see the following: If you copy this and paste it into something else you get the same results as what you see above. Also I tried saving the file in a number of formats (.csv, .html, .pdf, .txt, .prn, .dif) and you also get the same results as what you see. I only found one save format (that isn't compressed in some way) that has the unformatted numbers. (XML Spreadsheet 2003) So because of that I thought the data sent to the user when you are trying to save should be the formatted versions. If you can think of a better way of doing this by all means go ahead. Hopefully some of my code is reusable. |
This will be a little bit altered and merged in next 2 weeks. I cannot give you the exact date, but I am trying my best :) |
Hi, I was just now checking a way to add milliard separators to numbers in my tables. The international standard is using , (comma) milliard separator and . (point) for decimals. Though many countries use it the other way around. So the formatting should be based on locale anyway. But I think this change would be mechanism to achieve this automatic conversion, right? Based on warpech it could be available soon I believe. Cheers. |
The code I wrote for the formatting will not do this. I've never really needed to deal with internationalized numbers (here in Canada) before so I wrote enough to at least handle a comma being used for the decimal symbol. There is probably better code for formatting numbers and currency out there somewhere. I just did the best I could for what was needed by a project. |
Oh, I thought it would automatically add milliard and decimal separators based on some predefined rules. |
I feel sorry for not merging this pull request long time ago, but it seemed that it may be hard to maintain in future. I was looking for a solution where a custom cell types could use external libraries for data formatting and UI controls. Today one of such things was released in version 0.8.6 - "numeric" cell type. It allows to keep a cell value as More about this new cell type here: http://handsontable.com/demo/numeric.html |
Now, when we have Sorry that I could not merge it, but I opted for a solution that is using external libraries. Anyway, you influenced the changes a lot, thanks a lot @jayden-emergence! |
Created a way to format cells. Added default formatting types of
boolean, currency, date, number, and time. Created a demo with multiple
formats used and added documentation for the feature.