【问题标题】:Can I get index of items in gridster2 after dragging拖动后我可以获取gridster2中的项目索引吗
【发布时间】:2022-01-05 08:25:02
【问题描述】:
I just want a index of items of get both source and target items :
1.drageed item
2.on which item it is dropped

有没有办法获取索引。

我尝试了 itemChangeCallback - 它给了我 2 次相互交换但它没有给我它们的索引

【问题讨论】:

    标签: javascript html css angular angular-gridster2


    【解决方案1】:

    试试下面的代码:D

    const droppedItem = document.getElementById(".dropped");
    const index = items.findIndex(item => item.id === droppedItem.id);
    console.log(index);
    

    【讨论】:

    • 这在 angular gridster 中不起作用,无法找到此 ID。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 2020-08-31
    • 2011-08-17
    • 2011-11-09
    相关资源
    最近更新 更多