gpt4 book ai didi

javascript - Redips - 如何在 event.deleted 处理程序之前获取对象

转载 作者:行者123 更新时间:2023-11-30 12:52:20 24 4
gpt4 key购买 nike

这是我的代码:

   REDIPS.drag.event.deleted = function(){
//TODO
}

当一个对象被放入“垃圾桶”单元格时会被触发。我试图在它被删除之前获取对象 ID,因为我还想在数据库中删除它。我该怎么做?

在 redips 文档中说:

deleted(cloned) Event handler invoked if element is deleted (dropped to the "trash" table cell). Parameters: {Boolean} cloned Optional True if cloned element is directly moved to the trash (in one move). If cloned element is dropped to the table and then moved to the trash then "cloned" parameter will be set to false.

src:http://www.redips.net/javascript/redips-drag-documentation/#event:deleted

最佳答案

在大多数 REDIPS.drag 事件处理程序中,可以使用 rd.obj(或 REDIPS.drag.obj)检索对拖动的 DIV 元素的引用。方法如下:

rd.event.clicked = function(currentCell) {
classDetailPage.lastGridItemId = rd.obj.id;
};
rd.event.deleted = function() {
classDetailPage.deleteGridItem(classDetailPage.lastGridItemId);
};

...或直接在“已删除”事件处理程序中直接使用对 DIV 元素的引用:

rd.event.deleted = function() {
classDetailPage.deleteGridItem(rd.obj.id);
};

关于javascript - Redips - 如何在 event.deleted 处理程序之前获取对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20540786/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com