Git Product home page Git Product logo

Comments (18)

dgavey avatar dgavey commented on September 24, 2024

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.

AndyPyeSC avatar AndyPyeSC commented on September 24, 2024

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.

dgavey avatar dgavey commented on September 24, 2024

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.

AndyPyeSC avatar AndyPyeSC commented on September 24, 2024

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.

dgavey avatar dgavey commented on September 24, 2024

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.

AndyPyeSC avatar AndyPyeSC commented on September 24, 2024

No worries, sorry I can't provide a demonstration!

from ember-drag-drop.

gnazarkin avatar gnazarkin commented on September 24, 2024

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.

dgavey avatar dgavey commented on September 24, 2024

What is the structure of the array you are sending to it? POJO? Ember Data? Ember Object?

from ember-drag-drop.

gnazarkin avatar gnazarkin commented on September 24, 2024

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.

dgavey avatar dgavey commented on September 24, 2024

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.

gnazarkin avatar gnazarkin commented on September 24, 2024

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.

dgavey avatar dgavey commented on September 24, 2024

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.

dgavey avatar dgavey commented on September 24, 2024

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.

gnazarkin avatar gnazarkin commented on September 24, 2024

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.

dgavey avatar dgavey commented on September 24, 2024

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.

trumb1mj avatar trumb1mj commented on September 24, 2024

I copied the exact code from the demo and am seeing the same behavior described in this issue.

from ember-drag-drop.

gnazarkin avatar gnazarkin commented on September 24, 2024

@trumb1mj the fix is on the develop branch now. I'm using that branch with no problems

from ember-drag-drop.

dgavey avatar dgavey commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.