UI Kit 2: Dynamic Table: Column Ordering for % values are incrrect

The Completion(%) is sorted in descending order.

This past thread might be helpful: DynamicTable, sort does not work :( - #5 by shushen

Hi @shushen
Thanks for your help. I used this code and after testing, I found the ascending sort is ok, not incorrect for descending. Below are the 3 screenshots. Could you please help take a look again? Thanks

 {
          key: createKey(sprint.completionRate),
          content:
            <Inline alignInline="center">
              <Text>{((sprint.completionRate || 0) * 100).toFixed(1) + '%'}</Text>
            </Inline>,
        },




Thanks,
YY

If you use the createKey function as-is from the documentation, it converts a numeric parameter into string in a way that they might not be sorted as what you’d expect numbers to be sorted.

Plus the manipulation you’re doing in Text element hints that completionRate could be a non-zero false value, which could be converted to a string that you are not expecting.

Take a look at the output of createKey that you put into the keys of the cells, it should show you a good picture of what is happening. Good luck!

1 Like

Resolved. Thanks for your help.

1 Like