flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Kessler (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-33702) DataGrid columns unable to specify sorting internal compare functions used.
Date Sat, 14 Jun 2014 00:22:01 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14031358#comment-14031358
] 

Mark Kessler commented on FLEX-33702:
-------------------------------------

adding a rough test app...

<?xml version="1.0" encoding="utf-8"?>
<!---
   Test application
-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx"
               creationComplete="onCreationComplete();"> 

    <fx:Script>
        <![CDATA[
        import mx.collections.ArrayCollection;


        //----------------------------------------
        //  Variables
        //----------------------------------------
        [Bindable]
        protected var acSortTypes:ArrayCollection = new ArrayCollection();
        [Bindable]
        protected var acTestData:ArrayCollection = new ArrayCollection();


        //----------------------------------------
        //  Event handlers
        //----------------------------------------

        /**
        *  Change event handler for the SortTypes dropdownlist.
        */
        protected function ddlSortTypes_OnChange():void
        {
            acTestData.sort = null;
            acTestData.refresh();

            dgTestSpark.columnHeaderGroup.visibleSortIndicatorIndices = null;
        }


        /**
        *  CreationComplete event handler.
        */
        protected function onCreationComplete():void
        {
            //Setup sort compare types.
            //URL: http://flex.apache.org/asdoc/spark/collections/SortFieldCompareTypes.html
            acSortTypes.addItem({label:"string"});
            acSortTypes.addItem({label:"numeric"});
            acSortTypes.addItem({label:"date"});
            acSortTypes.addItem({label:"null"});
            acSortTypes.addItem({label:"xml"});


            //Setup test data.
            acTestData.addItem({id:1, title:"Test1", mixed:1, calendar:"01/01/2014"});
            acTestData.addItem({id:2, title:"Test2", mixed:2, calendar:"01/02/2014"});
            acTestData.addItem({id:3, title:"Test3", mixed:3, calendar:"01/03/2014"});
            acTestData.addItem({id:4, title:"Test4", mixed:4, calendar:"01/04/2014"});
            acTestData.addItem({id:5, title:"Test5", mixed:5, calendar:"01/05/2014"});
            acTestData.addItem({id:6, title:"Test6", mixed:"6", calendar:"01/06/2014"});
            acTestData.addItem({id:7, title:"Test7", mixed:"7", calendar:"01/07/2014"});
            acTestData.addItem({id:8, title:"Test8", mixed:"8", calendar:"01/08/2014"});
            acTestData.addItem({id:9, title:"Test9", mixed:"9", calendar:"01/09/2014"});
            acTestData.addItem({id:10, title:"Test10", mixed:"10", calendar:"01/10/2014"});
            acTestData.addItem({id:11, title:"Test11", mixed:true, calendar:"02/11/2014"});
            acTestData.addItem({id:12, title:"Test12", mixed:false, calendar:"02/12/2014"});
            acTestData.addItem({id:13, title:"Test13", mixed:"", calendar:"02/13/2014"});
            acTestData.addItem({id:14, title:"Test14", mixed:"", calendar:"02/14/2014"});
            acTestData.addItem({id:15, title:"Test15", mixed:true, calendar:"02/15/2014"});
            acTestData.addItem({id:16, title:"Test16", mixed:false, calendar:"02/16/2014"});
            acTestData.addItem({id:17, title:"Test17", mixed:"1.7", calendar:"02/17/2014"});
            acTestData.addItem({id:18, title:"Test18", mixed:"1.8", calendar:"02/18/2014"});
            acTestData.addItem({id:19, title:"Test19", mixed:null, calendar:"02/19/2014"});
            acTestData.addItem({id:20, title:"Test20", mixed:null, calendar:"02/20/2014"});
        }


        ]]>
    </fx:Script>

    <s:layout>
        <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" gap="30" />
    </s:layout>

    
    <!-- The sort type list -->
    <s:DropDownList id="ddlSortTypes" dataProvider="{acSortTypes}" requireSelection="true"
change="ddlSortTypes_OnChange();" />


    <s:HGroup gap="20">

        <!-- Spark datagrid example -->
        <s:DataGrid id="dgTestSpark" dataProvider="{acTestData}" width="400">
            <s:columns>
                <mx:ArrayList>
                    <s:GridColumn dataField="id" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                    <s:GridColumn dataField="title" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                    <s:GridColumn dataField="mixed" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                    <s:GridColumn dataField="calendar" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                </mx:ArrayList>
            </s:columns>
        </s:DataGrid>


        <!-- MX datagrid example -->
        <mx:DataGrid id="dgTestMX" dataProvider="{acTestData}" width="400">
            <mx:columns>
                <mx:DataGridColumn dataField="id" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                <mx:DataGridColumn dataField="title" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                <mx:DataGridColumn dataField="mixed" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                <mx:DataGridColumn dataField="calendar" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
            </mx:columns>
        </mx:DataGrid>

        
        <!-- MX advanced datagrid example -->
        <mx:AdvancedDataGrid id="adgTestMX" dataProvider="{acTestData}" width="400">
            <mx:columns>
                <mx:AdvancedDataGridColumn  dataField="id" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                <mx:AdvancedDataGridColumn  dataField="title" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                <mx:AdvancedDataGridColumn  dataField="mixed" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
                <mx:AdvancedDataGridColumn  dataField="calendar" sortCompareType="{ddlSortTypes.selectedItem.label}"
/>
            </mx:columns>
        </mx:AdvancedDataGrid>

    </s:HGroup>

</s:Application>


> DataGrid columns unable to specify sorting internal compare functions used.
> ---------------------------------------------------------------------------
>
>                 Key: FLEX-33702
>                 URL: https://issues.apache.org/jira/browse/FLEX-33702
>             Project: Apache Flex
>          Issue Type: Improvement
>          Components: Advanced Data Grid, mx: DataGrid, Spark: DataGrid
>    Affects Versions: Apache Flex 4.10.0
>            Reporter: Mark Kessler
>            Assignee: Mark Kessler
>            Priority: Minor
>             Fix For: Apache Flex 4.11.0
>
>
> The DataGrid columns do not allow selecting which type of internal compare function that
is used to sort the columns.  So inconsistent data formatting causes it to choose what it
thinks it the best formatting.  There should be an easy way to select it right from the columns
properties.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message