Skip to content
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

Average answer to the 2nd decimal place: Howto invoke this? #6

Open
summitmann opened this issue Sep 30, 2014 · 3 comments
Open

Average answer to the 2nd decimal place: Howto invoke this? #6

summitmann opened this issue Sep 30, 2014 · 3 comments

Comments

@summitmann
Copy link

Love the app... When I do an average calculation =b2/c2 My answer is an integer.
Is there a way to get the answer to the first or second decimal place? thanks in advance..

@cyadriane08
Copy link

please do try setting a format in your column in column properties.
for example: {type:'numeric', format:'0,0.00'}. you can search for the format in http://numeraljs.com/. or have it formatted by custom renderer.

@summitmann
Copy link
Author

Sorry,
But, I am not sure where to put {type:'numeric', format:'0,0.00'}. Where do I set my column properties?
Is that somewhere inside jquery.handsontable-excel.js ? I tried looking at the spreadsheet generated by index.html and just don't know where to go to set the format for my column... Thanks again.

@summitmann
Copy link
Author

i got it to work by modifying jquery.handsontable.full.js at:

Handsontable.NumericRenderer = function (instance, td, row, col, prop, value, cellProperties) {
if (typeof value === 'number') {
if (typeof cellProperties.language !== 'undefined') {
numeral.language(cellProperties.language)
}
td.innerHTML = numeral(value).format(cellProperties.format || '0.00'); //docs: http://numeraljs.com/
td.className = 'htNumeric';
// i changed td.innerHTML from 0 to 0.00
// thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants