Git Product home page Git Product logo

Comments (8)

lvegerano avatar lvegerano commented on September 27, 2024

Hi! could you share how you are using it?

from ember-sortablejs.

mikayelzarafyan avatar mikayelzarafyan commented on September 27, 2024

I use grid view with nested sortables. I want to pick one element and drop it into another cell with simulateDrag but unfortunately it doesn't work. But with the listView using nested sortables it works properly. Can you please give me some pieces of advice for this issue.
Looking forward for your response,
Thanks.

from ember-sortablejs.

lvegerano avatar lvegerano commented on September 27, 2024

I'll have to try this myself. simulateDrag is pretty simple all it does is grab and element and drop it on top of another. Could provide me with an example of what your sortable does? That way I have a concrete idea of what your code is trying to do.

from ember-sortablejs.

mikayelzarafyan avatar mikayelzarafyan commented on September 27, 2024

When sortable items are ordered vertically below each other the simulateDrag function works properly. But when I switch to horizontal view the simulateDrag function doesn't work.

from ember-sortablejs.

lvegerano avatar lvegerano commented on September 27, 2024

I just tried this as grid (css only) as well as the direction option set to horizontal and I was able to run a test. That being said, I think the drag simulation could be improved as to pick the drop location (e.i. topleft, bottomleft, etc).

At this point I will need a failing example to further help you.

from ember-sortablejs.

mikayelzarafyan avatar mikayelzarafyan commented on September 27, 2024

test('sortable test', async function (assert) {
const done = assert.async();
this.server.createList('entity', 7);
let store = this.owner.lookup('service:store');
let entities = await store.findAll('entity');
this.set('treeData', entities);

    this.set('onChoose', function () {});
    this.set('onMove', function () {});
    this.set('onEnd',  function () {});

    await render(hbs`
        <TreeWrapper
            @model={{treeData}}
            @onChoose={{action onChoose}}
            @onMove={{action onMove}}
            @onEnd={{action onEnd}}
        />
    `);

    let entityElements = findAll('[data-test-tree-item]');
    let dragTreeItem = entityElements[4];
    let targetTreeItem = entityElements[1];

    await simulateDrag(dragTreeItem, targetTreeItem);

});

`<SortableJs
class="sortable"
@options={{hash animation=150 fallbackOnBody=true swapThreshold=0.65 group=group dragClass="sortable-drag" disabled=disabledSortable }}
@onEnd={{action onEnd}}
@onChoose={{action "onChoose"}}
@onUnchoose={{action onUnchoose}}
@onchange={{action "onChange"}}

`<div class="tree-sortable>
{{#if sortedTreeData.length}}
{{#each sortedTreeData as |treeItem|}}
<TreeItem
@treeItem={{treeItem}}
@Onend={{action onEnd}}
@onChoose={{action onChoose}}
@onUnchoose={{action onUnchoose}} />
{{/each}}
{{/if}}

`
When I run this test on horizontal view, after simulateDrag onEnd function not work, but if I run it on vertical view onEnd is working, maybe after you add drop location (e.i. topleft, bottomleft, etc) it start work on horizontal view too.

Thanks.

from ember-sortablejs.

lvegerano avatar lvegerano commented on September 27, 2024

Thanks for taking the time. Where are you doing your assertion? Also would it be possible to reformat the sample?

from ember-sortablejs.

lvegerano avatar lvegerano commented on September 27, 2024

closing due to inactivity.

from ember-sortablejs.

Related Issues (9)

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.