I have a list with class x and in that list is a number of lists with class y.

我有一个带有类x的列表,在该列表中有许多带有类y的列表。

It is possible to drag an item from any of the sublists to any of the other sublists

可以将项目从任何子列表拖动到任何其他子列表

It is also possible to arrange the order of the sublists themselves.

也可以安排子列表本身的顺序。

I'm struggling with the events which are fired through the sortable

我正在努力解决通过可排序的事件

Receive - only triggers when something is brought into a list from elsewhere (so no good for arranging items in sublists or for arranging the sublists themselves)

接收 - 仅在将某些内容从其他位置放入列表时触发(因此无法在子列表中排列项目或排列子列表本身)

Update - seems to trigger multiple times when I drag an item from sublist A to sublist B (I assume as sublist A is being updated and sublist B is being updated).

更新 - 当我将项目从子列表A拖到子列表B时,似乎会多次触发(我假设子列表A正在更新,子列表B正在更新)。

I have a function in my JS which syncronises the current layout in the lists and sublists to the database and don't want to do this more than once at a time.

我在我的JS中有一个函数,它将列表和子列表中的当前布局同步到数据库,并且不希望一次多次执行此操作。

No combination of these events seems to give me the desired behaviour at all. Is this the right route to take? Or is there someway I can do a scheduled call to the Sync method which runs every 5 seconds or so to save changes and ignore the actual events themselves?

没有这些事件的组合似乎给了我理想的行为。这是正确的路线吗?或者有一些我可以对Sync方法进行预定调用,该方法每5秒运行一次以保存更改并忽略实际事件本身?

1 个解决方案

#1


You should use the stop event for updating the ordered list.

您应该使用stop事件来更新有序列表。

For example:

        $("#List .Items").sortable({
            stop: function(e, ui) { 
                // update items
            }
        });

更多相关文章

  1. Jquery注册服务器控件事件与判断控件的值
  2. 有关下拉框jquery里的change事件无法触发的问题
  3. jquery监听事件on写法以及简单的拖拽效果
  4. jQuery:在焦点上接收两个`focusin`事件
  5. jquery或者js中,如何mouseup事件后不执行click事件,在线等啊。
  6. jquery 触发a标签点击事件,弹出页面
  7. 单击列表项时如何编写内容? [重复]
  8. 从下拉列表中获取复选框的值
  9. 使用 jQuery Mobile 与 HTML5 开发 Web App(十一) —— jQuery Mob

随机推荐

  1. Android界面布局详解
  2. android简单学习总结
  3. Android开机启动流程
  4. Android之HttpPost与HttpGet使用
  5. Android(安卓)开发中的 Handler ,Thread
  6. Android LineaerLayout中layout_margin失
  7. 组件属性
  8. Android 15本经典教程和150多个实例源码
  9. android EditText提示居右无法显示的问题
  10. Android有效解决加载大图片时内存溢出的