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

key-field column value must be string? #36

Closed
ken-mills opened this issue Sep 25, 2020 · 4 comments
Closed

key-field column value must be string? #36

ken-mills opened this issue Sep 25, 2020 · 4 comments

Comments

@ken-mills
Copy link

Please forgive me if there is a better place to ask this question. If so, please advise because I have another non-related question.

When setting key-field=true on column that contains an integer, I get the following error in console when data is loaded:

[Vue warn]: Error in render: "TypeError: val.startsWith is not a function"

found in

---> <VueExcelEditor> at node_modules/vue-excel-editor/src/VueExcelEditor.vue

This happens regardless of setting the "type" prop on the column. If I cast the value in the json data to a string, it works. I am then able to get key in keys array in the OnUpdate event. My goal is to get a numeric key back in the keys array OnUpdate.
Is this intended behavior?
Thank you, Ken

@cscan
Copy link
Owner

cscan commented Sep 26, 2020

I remember the keys will be joined in somewhere so they must be strings. I forget I added the toString() or not. Let me do it in next update. Thanks for your report.

@ken-mills
Copy link
Author

I found the offending line (VueExcelColumn.vue (72) but ran into an issue testing the fix in my environment. Not sure if this is an appropriate fix or if other changes are necessary.

if (this.keyField && val && val.startsWith('§')) return ''

to

if (this.keyField && val && (typeof val === 'string') && val.startsWith('§')) return ''

@cscan
Copy link
Owner

cscan commented Sep 27, 2020

This is fixed in v.1.3.80

@cscan cscan closed this as completed Sep 27, 2020
@ken-mills
Copy link
Author

Tested. Works great. Thank you.

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