How does one implement the data move up and down functions in the list?

Source: Internet
Author: User
How does one implement the data move up and down functions in the list? How does one implement the data move up and down functions in the list?
The sort field is set in the database for mobile sorting. when this field is added, the creation timestamp is used by default, and the list is sorted by creation time in reverse order by default.
How can I obtain the upstream or downstream data id on the page?


Reply to discussion (solution)

Save the sort field as 1 2 3 4...
Then move 2 down and you will change 2 to 3 and 3 to 2 ~
Two data statements

Save the sort field as 1 2 3 4...
Then move 2 down and you will change 2 to 3 and 3 to 2 ~
The two DATA statements + 1, but the server releases the data in sequence. this requirement is unknown.

Save the id in the corresponding row data.

Save the sort field as 1 2 3 4...
Then move 2 down and you will change 2 to 3 and 3 to 2 ~
Two data statements
Data id operation
A 1 move up and down
B 2 move up and down
C 3 move up and down
My idea is to click B's move up and then pass the id values of B and a to the processing file. However, I do not know how to click B and pass the id of. To put it simply, how to obtain the id of a while operating B.

Reference the reply from hellodifa on the first floor: the sort field is saved as 1 2 3 4 at the creation time...
Then move 2 down and you will change 2 to 3 and 3 to 2 ~
Two data statements
Data id operation
A 1 move up and down
B 2 move up and down
C 3 move up and down
My idea is to click B's move up, and then pass the id values of B and a to review the text ......
This is a page operation, implemented using js

Reference the reply from hellodifa on the first floor: the sort field is saved as 1 2 3 4 at the creation time...
Then move 2 down and you will change 2 to 3 and 3 to 2 ~
Two data statements
Data id operation
A 1 move up and down
B 2 move up and down
C 3 move up and down
My idea is to click B's move up, and then pass the id values of B and a to review the text ......
After you click the button, you need to send ajax asynchronous operations to ensure that the page is not refreshed and the up-shift effect is achieved ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.