Comments (18)
Hmm, not sure. I had this issue the other day when I was implementing it, and I was passing the wrong variable to content= in the draggable-object component.
Maybe if you could post the template code for what you got, I might be able to figure it out.
from ember-drag-drop.
I got to the point where I literally copied the template, controller and styles from the demo into my app, and that still didn't work...
I've since changed to a different package (ember-sortable), which initially showed the same behaviour until I realised that I wasn't updating the original array in my "order changed" handler. I'm not sure this was the same problem as I experienced with yours though. Sorry I can't be any more help!
from ember-drag-drop.
Well, in this addon, the library updates the array for you so you shouldn't have to do it yourself. Are you using ember-data? I haven't tested with that yet. I have tested with ember-model and plain arrays though.
from ember-drag-drop.
Yes, ember-sortable uses the "Data Down, Actions Up" pattern. I started off using ember-data (I was displaying the items in a hasMany relationship), but as I said, I copied the example code in just to see if that works, and it still didn't (i.e. the array was a plain array as a property on the controller).
from ember-drag-drop.
Well, in my experience a 'plain' array will not re-render on a change. It would have to be an Ember array that you pass in. This should have worked with Ember data though. This probably isn't the issue though. Sorry it didn't work for you, wish I had an answer. Of course a failing js-bin would be super helpful, but I understand that's probably not possible.
from ember-drag-drop.
No worries, sorry I can't provide a demonstration!
from ember-drag-drop.
Having the exact problem described here. The underlying array is sorted properly but the displayed list in the sortable-objects component is displayed incorrectly. Made sure to check if I was passing the correct variable to content in the draggable-object component
from ember-drag-drop.
What is the structure of the array you are sending to it? POJO? Ember Data? Ember Object?
from ember-drag-drop.
Ember Data. This is how I have it implemented right now
{{#sortable-objects sortableObjectList=model.fields sortEndAction='sortEndAction' enableSort=true}}
{{#each model.fields as |item|}}
{{#draggable-object content=item isSortable=true}}
{{item.name}}
{{/draggable-object}}
{{/each}}
{{/sortable-objects}}
from ember-drag-drop.
Well your template looks ok. I'm getting the picture it's a problem with Ember Data objects. Gonna try and make a failing case later. What is the model definition for model.fields?
Also visually as you drag an element over another element the elements nodes should swap. So visually you should see the element change position as soon as your overtop of a new element. You can look at the demo to see what I mean. Do you see that visual change?
from ember-drag-drop.
It's a hasMany relationship. model hasMany fields and field belongsTo model. And the visuals are working fine with the changes as described
from ember-drag-drop.
Ok, thanks for the info, I'll try and get a failing case using Ember Data. Of course, if you are able to make me a failing JSBin that would be awesome!
from ember-drag-drop.
Sorry, got busy. I found time tonight to put an example together using Ember Data and my simple example seems to work fine. I'm still at a complete loss to figure out what the issue is. If there is any way I could play with the code that is having the issue that would be helpful. Otherwise I guess I need a failing case to work from.
from ember-drag-drop.
If you want I can screenshare and show you my code/implementation. Shoot me an email at {redacted} and we can figure something out
from ember-drag-drop.
I've finally nailed down where the issue is. It seems the problem affects all Glimmer based releases of Ember 1.13 and up. I'm still working on a fix, hopefully soon. It has to do with my use of swapping nodes in the DOM. Glimmer releases of Ember get confused, previous releases are fine.
from ember-drag-drop.
I copied the exact code from the demo and am seeing the same behavior described in this issue.
from ember-drag-drop.
@trumb1mj the fix is on the develop branch now. I'm using that branch with no problems
from ember-drag-drop.
An Ember version 1.13.2 plus compatible version of sortable objects has been published under version 0.3.0 . Integration tests have been written as well. So hopefully I'll know of failing cases in new ember versions first.
from ember-drag-drop.
Related Issues (20)
- Component#sendAction is deprecated HOT 16
- only allow specific object to be dropped HOT 2
- dragging "through" a draggable-object HOT 2
- drag-handle is not reconnected when component nested under draggable-object re-renders HOT 6
- fix the draggable-object-target lose the class accepts-drag HOT 2
- Multi list sorting - add draggable-object on drop
- 0.7.0 changelog and breaking changes ? HOT 1
- In Acceptance tests, drag-drop helper fails to trigger the dragend event
- Passing hasMany relationship into {{#sortable-objects}} HOT 1
- Possible to style sortable options like Spotify? HOT 2
- Cannot create 2 test using drap HOT 1
- Can not move DraggableObject into SortableObjects if SortableObjects is empty
- Example of sorting in README.md has errors
- Embroider compatibility problems HOT 1
- Trigger `dragenter` and `dragleave` as part of `dragOverMoves` option
- Full Ember Octane Compatibility? HOT 1
- Forward `dragleave` event to `@handleDragOut`
- DragOvering the DraggableObject from one SortableObjects to another not working properly. HOT 2
- "no obj for key" error
- Incompatible with `ember-cli-mirage` v3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-drag-drop.