tags:

views:

337

answers:

1

Hi,

I want the flex dataGrid to implement a drilldown effect.The data to the datagrid is obtained from a xml file.Can anyone help me out in this.

TIA

A: 

Datagrid should be something like this:

<mx:DataGrid id="DataGridAnswers"
                 top="10" bottom="10" left="10" right="10"
                 >
        <mx:columns>
            <mx:DataGridColumn>
                <mx:itemRenderer>
                    <fx:Component>
                        <mx:LinkButton label="Посмотреть результат"
                                       click="linkbutton1_clickHandler(data.test_id, data.id)">
                            <fx:Script>
                                <![CDATA[
                                    import etc.NavigationEvent;
                                    protected function linkbutton1_clickHandler(testId:int, answerId:int):void
                                    {
                                        var navEvent:NavigationEvent = 
                                            new NavigationEvent(NavigationEvent.NAVIGATION_STRING, 
                                                NavigationEvent.REPORTS_SCREEN, true, true);
                                        navEvent.testId = testId;
                                        navEvent.answerId = answerId;
                                        dispatchEvent(navEvent);
                                    }
                                ]]>
                            </fx:Script>
                        </mx:LinkButton>
                    </fx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
        </mx:columns>
    </mx:DataGrid>

And handle this event in container like this:

protected function navigationHandler(event:NavigationEvent):void
            {
                // выбрать соответвтующий экран на главном меню
                mainMenu.selectScreen(event.screen);

                switch (event.screen)
                {
                    case NavigationEvent.LOGOUT:
                                                       ...
                        break;

                }

                // Переключить вью стек
                if (screenDic[event.screen] != null)
                    viewStack_main.selectedChild = screenDic[event.screen];
            }

plus add eventlistener to container

initialize="this.addEventListener(NavigationEvent.NAVIGATION_STRING, navigationHandler)"
Egor
Thanks...It really helps
Anupama
Can you than mark it as an answer please?
Egor