I have an AdvancedDataGrid with two columns that have item renderers. Those item renderers are rendering link buttons in their respective columns. I want to be able to click on those link buttons without triggering the itemClick event of the AdvancedDataGrid. Any suggestions for how I could accomplish this?

1

There are 1 answers

0
Black Dynamite On BEST ANSWER

I've never worked with an AdvancedDataGrid but I assume a few principles hold. The first being the behavior of event propagation. The event gets processed by the button before it gets processed by the grid. This means that we can catch and stop the event from ever reaching the DataGrid. Below is a code sample demonstrating how a DataGrid renderer can have a Button without triggering other behavior.

CustomerRenderer...
<fx:Script>
    <![CDATA[
        protected function watchButtonClickHandler(event:MouseEvent):void
        {
                            //the line below stops the event from 
                            //propagating through the rest of the display
                            //list
            event.stopImmediatePropagation();
                            //handle button click logic here

        }
    ]]>
</fx:Script>
<s:Group width="100%" id="buttonGroup">
    <s:layout>
        <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"
                            paddingBottom="1" paddingLeft="1" 
                            paddingRight="1" paddingTop="1" />
    </s:layout>
    <s:Button id="watchButton" width="98" label="{buttonLabel}" 
                click="watchButtonClickHandler(event)"/>
</s:Group>
....