在ember-drag-sort中标识targetList [英] Identifying targetList in ember-drag-sort

查看:121
本文介绍了在ember-drag-sort中标识targetList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将 ember-drag-sort 嵌套列表实现为我的Ember.js应用程序。

I am currently trying to implement an ember-drag-sort nested list into my Ember.js app.

是否可以在dragEnd操作中确定该项目已放入哪个子列表? (例如,类名,ID等)

Is there a way to determine in the dragEnd action which "sub-list" the item has been dropped into? (e.g. a class name, id etc)

在我的场景中,我正在对可以彼此属于的余烬数据记录(即嵌套的树结构)进行排序。当我将一个嵌套记录拖到另一个记录中(使拖拽的记录成为第二个记录的子记录)时,我需要更新ember-data中的parent属性。我的问题是,如何将第二条记录(新的父项)的ID传递给dragEnd操作?

In my scenario, I am sorting ember data records that can belong to each other (i.e. a nested, 'tree' structure). When I drag one nested record "into" another (making the dragged record a child of the second record), I need to update the parent attribute in ember-data. My question is, how do you pass some id of the second record (the new parent) to the dragEnd action?

这甚至有可能吗?

编辑:

换句话说,我希望能够确定

To put it another way, I want to be able to identify which list I have dropped the item into.

推荐答案

targetList 是指组件拖动侧的数组。要将父母与孩子一同推向目标清单,您可以看一下 twiddle

targetList refers to the array on the dragged side of the component. For pushing the parent to the target list alongside the child, you can take a look at this twiddle.

这篇关于在ember-drag-sort中标识targetList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆