sortable 前端拖拽排序,后排處理


sortable.js 中文網  http://www.sortablejs.com/index.html

 下載:https://pan.baidu.com/s/1EFfwctub3LrVayWZ_HwqMg

<span id="courseLabelNames" style="cursor:pointer;"></span>
$("#courseLabelNames").append(
     "<span style=\"padding:10px;margin-left:12px;\" data-id=" + courseInfoId + ">" + courseTitle + "</span>");
courseInfoId  sort  表字段 sort 排序,courseInfoId  id主鍵
<script type="text/javascript" src="<%=basePath%>/js/Sortable/Sortable.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/Sortable/st/app.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/Sortable/jquery.binding.js"></script>
<script type="text/javascript">
    Sortable.create(document.getElementById('courseLabelNames'), {
        group: "localStorage-example",
        sort: true,
        animation: 150,
        store: {
            get: function (sortable) {
                var order = localStorage.getItem(sortable.options.group.name);
          console.log("排序前字段排序"+order)
return order ? order.split("|") : []; }, set: function (sortable) { var order = sortable.toArray(); localStorage.setItem(sortable.options.group.name, order.join("|"));
          console.log("排序后的字段排序"+order) $(
"#checkedCourseIds").val(order) } }, }); </script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM