Toggling the Type column on the FileSystemDataGrid control in Adobe AIR

by Peter deHaan on December 18, 2008 · 0 comments

in FileSystemDataGrid

The following code shows how you can toggle the visibility of the Type column in the Adobe AIR FileSystemDataGrid control by setting the typeColumn object’s visible property.

Full code after the jump.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://airexamples.com/2008/12/18/toggling-the-type-column-on-the-filesystemdatagrid-control-in-adobe-air/ -->
<mx:WindowedApplication name="FileSystemDataGrid_typeColumn_visible_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
 
    <mx:Script>
        <![CDATA[
            import mx.events.FileEvent;
 
            private function checkBox_click(evt:Event):void {
                dataGrid.typeColumn.visible = checkBox.selected;
            }
 
            private function dataGrid_directoryChange(evt:FileEvent):void {
                application.status = evt.file.nativePath;
            }
        ]]>
    </mx:Script>
 
    <mx:ApplicationControlBar dock="true">
        <mx:CheckBox id="checkBox"
                label="typeColumn.visible"
                selected="true"
                change="checkBox_click(event);" />
    </mx:ApplicationControlBar>
 
    <mx:FileSystemDataGrid id="dataGrid"
            directoryChange="dataGrid_directoryChange(event);"
            width="100%"
            height="100%" />
 
</mx:WindowedApplication>

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: