I have an HTML list that can be sorted (using the jQuery sortable API ). I save list items inside the database; each line preserves the order of the elements and the text. How to keep the order of the list items, so I don’t need to update multiple lines when changing the order of the item? List items can be added and removed.
Here is an example of what I am saying:
<ol> <li>Go shopping</li> <!-- Order: 1 --> <li>Go jogging</li> <!-- Order: 2 --> <li>Eat</li> <!-- Order: 3 --> </ol>
The user moves the Eat list item at the top, now I have to update each row in the database to save the order.
<ol> <li>Eat</li> <!-- Order: 3, now update to 1 --> <li>Go shopping</li> <!-- Order: 1, now update to 2 --> <li>Go jogging</li> <!-- Order: 2 now update to 3 --> </ol>
, , , - "" , "" , ..., 1,2,3 3,1,2 .
, , :
, -, . , , , - "" ""., , -, , , , .
2
Source: https://habr.com/ru/post/1709262/More articles:Problems with Delphi - TWebBrowser - delphiPHP / JavaScript. The browser "downloads" forever, even after all resources are completed, as well as problems with Opera / Chrome - javascriptКак конкатенировать имена переменных в javascript? - javascriptEC2onRails + SSL + Apache: no response to port 443 - ruby-on-railsCreate RSS RSS feeds (MRSS) in ASP.NET 3.5 - asp.netImplementing a search box using ASP.NET MVC, SQL Server, Entity Framework - searchIs there memory efficiency when code is wrapped in functions? - functionSample Blackberry Sound Recording Code - audioGood / funny / useful mnemonic devices? - mnemonicsHow to use JBossAS 5 with Apache Ivy? - jbossAll Articles