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

Number setting for colWidths not work #947

Closed
xinfli opened this issue Aug 5, 2013 · 5 comments
Closed

Number setting for colWidths not work #947

xinfli opened this issue Aug 5, 2013 · 5 comments

Comments

@xinfli
Copy link

xinfli commented Aug 5, 2013

If set colWidths to a number instead array or function, the column width will always set to default value (50), the setting will not work.

Refer to http://jsfiddle.net/aTtmT/

Add lines below into implementation of "this._getColWidthFromSettings" can fix this problem (for version 0.9.11):

    else if (Object.prototype.toString.call(priv.settings.colWidths) === '[object Number]' && priv.settings.colWidths > 0) {
        return priv.settings.colWidths;
    }
@psmolenski
Copy link
Contributor

Please note, that colWidths accepts only an array of numbers. The documentation states:

colWidths : Array (default [50, ..])
Defines column widths in pixels (array of numbers)

If you have any further questions, feel free to reopen this issue.

@xinfli
Copy link
Author

xinfli commented Aug 6, 2013

Thanks, please fix the wrong comments "//can also be a number or a function" in http://handsontable.com/demo/fixed.html

I copied the example code to my application and found it not works...

@psmolenski
Copy link
Contributor

Thanks for pointing this out and sorry for misleading comments. I've already corrected the fixed.html example.

@artburkart
Copy link

I think there is one more page containing the comment "//can also be a number or a function" at http://handsontable.com/demo/scroll.html - thought I'd bring it to your attention so it can be updated too.

@warpech
Copy link
Member

warpech commented Aug 25, 2013

As a side feature I just added possibility to use a number for colWidths in version 0.9.15. I updated the docs: https://github.com/warpech/jquery-handsontable/wiki/Options

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

No branches or pull requests

5 participants