1

This is my code:

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

This is fired when an object is dropped in the 'trash' cell. I am trying to get the object id before it gets deleted, because I alse want to delete it in the database. How can I do this?

In the redips documentation it says :

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

4

2 回答 2

2

在大多数 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);
};
于 2014-04-15T12:50:44.217 回答
1

在 clicked 功能中,您可以为将要删除的 div 设置备份。

        rd.event.clicked=function(currentCell){
            classDetailPage.lastGridItemId = $(currentCell).find("div")[0].id;
        };
        rd.event.deleted = function(){
            classDetailPage.deleteGridItem(classDetailPage.lastGridItemId);     
        };
于 2013-12-12T11:40:58.837 回答