Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

b-table sort#7220

Unanswered
shes6006 asked this question inQ&A
Oct 18, 2024· 1 comment
Discussion options

I'm using b-table default sorting method and I found that in the method the all value will be transformed to String as follows:

function toString(value) {  if (value === null || typeof value === 'undefined') {    return ''  } else if (value instanceof Object) {    return Object.keys(value)      .sort()      .map(key => toString(value[key]))      .join(' ')  } else {    return String(value)  }}

therefore, when my field values are alphabets with numbers and starts with '0' the sorting will cause problem.
For example, '007D2' will be smaller than '00500', cause 00500 will go to "String(value)" and I get "320"
I wonder if it is inevitable or the toString function above can be improved ?

FYI, I customized my compare routine to avoid the situation, but I just wonder there is any solution to avoid it in the toString function

You must be logged in to vote

Replies: 1 comment

Comment options

Can you share your fix for this problem? Or did you get some solution for this ?

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@shes6006@mitulagrawal607

[8]ページ先頭

©2009-2025 Movatter.jp