reorder table with javascript

  • 3
  • Question
  • Updated 2 years ago
Is it possible to reorder a model or a table based on a field with javascript?

After adopting a bunch of rows into a model, I want to order by a date field.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 3
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
Matt did you ever come a solution for this?

I'd prefer to use a skuid-like solution before importing a table library.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
No that I recall. Sorry.

In principal, you could store the javascript rows object in a variable, reorder them in javascript, remove all the rows from the model, and add the rows from the reordered object variable.
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
Actually, that's brilliant! Would you use adoptRows to accomplish this?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
yep, that sounds right to me.