Hi all,

        I have defined custom data grid with checkbox. I am not able to
disable the checkbox coming as a part of header field of the data grid.
Custom component is defined as follows.

    public class CheckBoxDataGrid extends DataGrid
    {

        override protected function selectItem(item:IListItemRenderer,
                                               shiftKey:Boolean,
ctrlKey:Boolean,
                                               transition:Boolean =
true):Boolean
        {
            // only run selection code if a checkbox was hit and always
            // pretend we're using ctrl selection
            if (item is CheckBox)
                return super.selectItem(item, false, true, transition);
            return false;
        }

        // turn off selection indicator
        override protected function drawSelectionIndicator(
            indicator:Sprite, x:Number, y:Number,
            width:Number, height:Number, color:uint,
            itemRenderer:IListItemRenderer):void
        {
        }

        // whenever we draw the renderer, make sure we re-eval the checked
state
        override protected function drawItem(item:IListItemRenderer,
                                             selected:Boolean = false,
                                             highlighted:Boolean = false,
                                             caret:Boolean = false,
                                             transition:Boolean =
false):void
        {
            if (item is CheckBox)
                CheckBox(item).invalidateProperties();
            super.drawItem(item, selected, highlighted, caret, transition);
        }

        // fake all keyboard interaction as if it had the ctrl key down
        override protected function keyDownHandler(event:KeyboardEvent):void
        {
            // this is technically illegal, but works
            event.ctrlKey = true;
            event.shiftKey = false;
            super.keyDownHandler(event);
        }

    }

Thanks & Regards,
Namrata

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to