English 中文(简体)
YUI onDragDrop multiple listeners
原标题:
  • 时间:2009-11-12 14:18:30
  •  标签:
  • events
  • yui

I was wondering if anyone was aware of an example that shows multiple listeners to the YUI DDProxy, DD, or DDTarget onDragDrop event. Currently I have a hacked up example going. I m using the http://developer.yahoo.com/yui/examples/datatable/dt_ddrows.html >DataTable Reorder Rows example. I ve modified it into several js classes. One object they override DDProxy for handles the onDragDrop event but it seems that if it s handled here then nothing else catches the event. Check the snip:

YAHOO.extend(YAHOO.example.DDRows, YAHOO.util.DDProxy, {
    //snip
    onDragDrop: function(e, id) {
    if (id == "right-function-pane") {
        alert("In the right drop place");

        YAHOO.util.DragDropMgr.refreshCache();
    }
}

In a class that does the creation of DDRows, I want to listen to the event here as well. Some actions are more appropriate in some places. I want to listen to the event in both places. Here s what I m doing in class that builds the above:

    onDropHandler: function(e, id) {
        DragDropTable.myDataTable.deleteRow(YAHOO.util.DragDropMgr.dragCurrent.id);
    },

    rowInitializer: function() {
    var i, id, myDDRow,
        allRows = DragDropTable.myDataTable.getTbodyEl().rows;

    for (i = 0; i < allRows.length; i++) {
        id = allRows[i].id;
        // Clean up any existing Drag instances
        if (DragDropTable.myDTDrags[id]) {
            DragDropTable.myDTDrags[id].unreg();
            delete DragDropTable.myDTDrags[id];
        }
        // Create a Drag instance for each row
        myDDRow = new YAHOO.example.DDRows(id);
        myDDRow.srcData = DragDropTable.myDataTable.getRecord(id).getData();
        myDDRow.onDragDrop = DragDropTable.onDropHandler;            
        DragDropTable.myDTDrags[id] = myDDRow;
    }
}

It seems like if one is listening the other isn t working. I haven t found the syntax for allowing events to continue to bubble or to have multiple subscriptions to onDragDrop. Does anyone have the correct syntax?

Thanks Josh Robinson

问题回答

暂无回答




相关问题
Mysql trigger/events vs Cronjob

I have an auction website which let my users place an unlimited amount of autobiddings. To monitor these autobiddings something has to check the database every second. My question is if it is ...

Can an event be used as an event listener?

I m trying to expose some events from a private object which is contained inside the object I am creating and it looks like the compiler is happy with this: private WindowUpdateServer ...

鸡奸

由于将javascript DOM方法放在第html页底部(在<有人>之后)远比利用“j Query”准备活动要快得多,因此我们不得不这样做:

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

jQuery bind on ajax load() event

I have a page which displays multiple blocks with results details. Inside each block I have some <a> tags with thickbox jQuery plugin attached: class="thickbox" Here is an example of one kind ...

HTML text input event

I have a form, and want to disable/enable its submit button depending on whether the form s input text fields are empty or have had text entered into them. I think this means having an event handler ...

IE doesn t run Javascript when you click back button

I ve built a shop with tons of JS running. One of the pieces of the cart, is a zip code field which is required to calculate shipping cost. This works fine going through the cart. Now clicking ...

热门标签