Hi, I'm fairly new to Flex and I'd appreciate your help. I'm trying the 
following:

I have a DataGrid with 28 columns representing a calendar of some sort with 
"dropEnabled" set to "true" and all the drop events defined (dragEnter, 
dragExit, dragDrop). This part works very well.

The leftmost column, which is locked ("lockedColumnCount=1"), represents 
resources and the other columns have a count of defects associated to each 
resource at a specific date.

I also have a List with "dragEnabled" set to "true". This list contains a list 
of defect objects which are different than what is displayed in the DataGrid.

When the user clicks on a number of defects displayed in the DataGrid for a 
resource, the list of defects is displayed in the list.

My goal is to be able to drag a defect displayed in the list to a new resource 
/ date location in the DataGrid and update the counts displayed.

So far, I'm able to get the row (through "calculateDropIndex") but I am unable 
to figure out the column.

I tried calculating the column from the mouse position (x) by adding the 
columns widths as I iterate through the columns this way:

===========================================================
private function calculateDropColumn(event:DragEvent):int {

   var colWidth:int = 0;
   var mouseXpos:int = event.localX;
   var dropTarget:DataGrid = DataGrid(event.currentTarget);

   for (var i:int = 0; i < dropTarget.columns.length; i++) {

      if (mouseXpos >= colWidth && mouseXpos <= (colWidth +
         dropTarget.columns[i].width)) {

         return i;
      }

      colWidth += dropTarget.columns[i].width;

   }

   return -1;
}
===========================================================

It works fine until I start scrolling the columns to the right...

I saw that the DataGrid maintains an Array of "visibleColumns" and 
"visibleLockedColumns" internally through the debugger, but they are not 
exposed (mx_internal namespace).

Anybody has a better way? Am I using the correct component for this kind of 
thing? Is there a way to determine the "visibleColumns" another way?

Thanks for your help as I am at a lost...

Marc

Reply via email to