Skip to content

Formatting should use the displayed value, not the data-sort value #306

@fisharebest

Description

@fisharebest

See https://codepen.io/fisharebest/pen/dPbPddq for a live example.

Adding data-sort to a column causes it to be formatted according to the type of data-sort, rather than the type of the displayed value.

Without data-sort, column one is left-justified and column two is right-justified - as expected.

<table>
  <thead>
    <tr><td>Medal</td><td>Count</td></tr>
  </thead>
  <tbody>
    <tr><td>Gold</td><td>3</td></tr>
    <tr><td>Silver</td><td>2</td></tr>
    <tr><td>Bronze</td><td>4</td></tr>
  </tbody>
</table>

With data-sort, both columns are now right-justified - which is wrong. Changing the sorting shouldn't change the display.

<table>
  <thead>
    <tr><td>Medal</td><td>Count</td></tr>
  </thead>
  <tbody>
    <tr><td data-sort="1">Gold</td><td>3</td></tr>
    <tr><td data-sort="2">Silver</td><td>2</td></tr>
    <tr><td data-sort="3">Bronze</td><td>4</td></tr>
  </tbody>
</table>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions