angular-ui/ui-grid

Sort function is guessed as sortAlpha and cached when sort applied to empty grid

Open

#5,279 opened on Apr 4, 2016

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (5,395 stars) (2,496 forks)batch import
help wanted

Description

When there is no data in the grid and the user clicks to sort a column, the row sort function will be cached based on the guess (sortAlpha). Say this is a numeric column and you later add data, it will always sort as alpha because the guess was cached.

Workaround (and probably best practice): specify explicitly rather than rely on guess. But it's possible to accidentally rely on guess.

  • This is a bug report, not a question on how to use the grid.
    Use Stack Overflow or Gitter for questions.
  • You have searched the open issues to see if this bug has been filed before. We don't want duplicate issues.
  • You have reviewed the tutorials and documentation to ensure you are using the grid correctly. ui-grid.info
  • You are using the latest version of the grid. Older versions are not patched or supported.
  • You have provided steps to recreate your bug. A plunkr is even better.

Contributor guide