ember-drag-sort | sortable list component with support for multiple | Widget library
kandi X-RAY | ember-drag-sort Summary
kandi X-RAY | ember-drag-sort Summary
A drag'n'drop sortable list addon.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ember-drag-sort
ember-drag-sort Key Features
ember-drag-sort Examples and Code Snippets
Community Discussions
Trending Discussions on ember-drag-sort
QUESTION
Originally asked by @andrewsyd on GitHub.
...For a nested list, 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)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?Is this even possible?
ANSWER
Answered 2017-Nov-13 at 17:41isParent
attribute into a derived value rather than a source of truth
Having an isParent
attribute that must be updated by hand is a flawed approach in the first place.
If you have the isParent
state as an attribute and require the frontend to update it, then you have two sources of truth that can (and eventually will) go out of sync. Especially so given the fact that users can tamper with network requests to your API backend.
The isParent
should be inferred from the amount of children. It could be a simple computed property:
QUESTION
ANSWER
Answered 2017-Nov-13 at 14:25ember-drag-sort
uses a simple CSS technique to render the placeholder: :before
and :after
pseudoelements.
Unfortunately, this doesn't work with HTML tables because table semantics are very restrictive. To work around this problem, top/bottom padding on table cells can be used instead of selectors.
This is not a great solution because padding appears inside table cells. If you want your cells to have borders, you'll have to apply them to inner elements instead.
Tables are now part of the demo, please have a look.
Here are the CSS overrides used in the demo:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ember-drag-sort
git clone <repository-url> this repository
cd ember-drag-sort
yarn install :warning:
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page