tags:

views:

102

answers:

1

Hi,

I have a Advanced DataGrid for displaying the number of rows from the Database and one row strictly should not allowed drag option. Is is possible? Please share one sample example.

Thanks, Ravi

A: 

Of course this is possible. Add a dragEnter Handler to your datagrid:

<mx:AdvancedDataGrid id="adg" dragEnabled="true" dragEnter="adg_dragEnterHandler(event)" />

With the following code:

protected var _draggedItem:Object;

            protected function adg_dragEnterHandler(event:DragEvent):void
            {
                event.preventDefault();
                event.currentTarget.hideDropFeedback(event);

                var items:Array = ds.dataForFormat("items") as Array;
                if (items != null && items.length > 0 && (items[0] is CategoryVO)) {
                    _draggedItem = Object(items[0]);
                }

                // Prevent item from being dragged
                if (_draggedItem.property == true) {
                    DragManager.showFeedback(DragManager.NONE);
                    return;
                }

                DragManager.acceptDragDrop(UIComponent(event.currentTarget));

            }

_draggedItem.property == true is the check, if an item can't be dragged.

Thomas
@Thomos: this above example is showing Draging the any Rows in advanced datagrid from one place to another place is not allowing But i need one particular row only not allowing to drag and drop.suppose I have a advanced datagrid with 10 rows.I need to allowed all the rows to draga nd drop except one.
Ravi K Chowdary
Did you chance the line with "_draggedItem.property" to your needs? This was just an example.
Thomas