View Full Version : drag grid row and drop target

23 Dec 2006, 11:57 PM
I faced two problems when dragging grid rows to a target. please help me with some idea.

problem 1(drop target):
with YAHOO.util.DDTarget(elmId, 'GridDD') I defined a number of elements as target. and then I want to define a rule using css class for those elements so that elements having that class will not served as target. here I used addInvalidHandleClass('some-class') but no luck. how can I use this method.

problem 2(number of rows dragged):
when dragging rows of a grid it shows '%0 selected row(s)' proxy text. I have changed it with 'ddText' property and works correctly.
But problem arises when I tried to show one type of ddText when one row dragged and anoter type of ddText when more than one rows dragged.
here I use 'startdrag' event and handle with grid.getSelectionModel().getCount() to get number of rows dragged and set texts accordingly. but getCount returns number of previously selected rows.

For example if I drag 1 row then 2 rows and then 3 rows. then in case of 2 rows it sows the text for 1 row and in 3rd case it sows the text of second case. But the '%0' shows the right number.


24 Dec 2006, 12:34 AM
1. I don't know the answer to this, I've never used that function.

2. Take a look at http://www.jackslocum.com/blog/2006/09/28/drag-and-drop-with-the-grid-part-1/ towards the end it explains exactly how to do it in a shorter and more reliable way.