S
S
shynga2020-04-19 08:44:58
JavaScript
shynga, 2020-04-19 08:44:58

How to enter data into a table with sorting?

Good afternoon!
I would like to know how to implement the following functionality.

There is a calculator, which, after pressing the button, generates a number that should be displayed in the table.
Roughly speaking, there is a table in which numbers go from 1 to 20 and a new number is created, let's say 12 and it should be displayed in the table in 12th place and the points should line up from 1 to 21.

I don't know how to do it easier. It can show a Word or Excel file, or it's easier to somehow display them in a made-up table.

Files do not need to be saved, that is, after showing the file, it is not saved, it is simply shown in order.

Roughly speaking. How to sort in the table

If anyone can help I will be very grateful!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Ushenin, 2020-04-19
@usheninmike

  1. Iterate over the rows of the table and store them in an array of objects. Each object has two fields: a table row and the value of the number in that row.
  2. Sort this array by the number field.
  3. Delete all rows from the table.
  4. Populate the table with rows from a sorted array of objects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question