<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark"  
         xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" 
         xmlns:nestedtreedatagrid="com.flexicious.nestedtreedatagrid.*" 
         xmlns:controls="com.flexicious.controls.*"
         xmlns:functional="com.flexicious.example.view.functional.*"
         creationComplete="application1_creationCompleteHandler(event)"
         >
    
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import com.flexicious.example.view.functional.MyDataGrid;
            import com.flexicious.example.view.support.customprint.MyCustomPager;
            import com.flexicious.nestedtreedatagrid.interfaces.IFlexDataGridCell;
            
            import mock.FlexiciousMockGenerator;
            
            import mx.events.FlexEvent;
            
            
            
            protected function application1_creationCompleteHandler(event:FlexEvent):void
            {
                mdg.buildFromXml(FlexiciousMockGenerator.mockNestedXml);
                mdg.dataProvider=FlexiciousMockGenerator.mockNestedData;
                mdg.validateNow();
                mdg.expandAll();
                mdg.columnLevel.rowDisabledFunction=checkRowDisabled
            }
            
            function checkRowDisabled(cell:IFlexDataGridCell, data:Object):Boolean{
                if(!cbDisable.selected)return false;
                return data.hasOwnProperty("title")&&data.title=="Architect";
            }
        ]]>
    </fx:Script>
    <mx:HBox>
        <mx:CheckBox label="Use Selection Exclusion" click="mdg.enableSelectionExclusion=event.target.selected"/>
        <mx:CheckBox label="Use Selection Cascade"  click="mdg.enableSelectionCascade=event.target.selected"/>
        <mx:CheckBox label="Use Selection Bubble"  click="mdg.enableSelectionBubble=event.target.selected"/>
        <mx:CheckBox label="Use Tri State"  click="mdg.enableTriStateCheckbox=event.target.selected"/>
        <mx:CheckBox label="Disable Selection for a Row"  id="cbDisable" change="mdg.redrawBody();"/>
    </mx:HBox>
    
    <functional:MyDataGrid id="mdg" verticalGridLines="false"
                           width="100%" 
                           height="100%"/>
            
</mx:VBox>