Flex selectedItem sort order

43 Views Asked by At

I have a code as following

            var selectedWindows = new ShowSelectedFilesFolderWindow;
            selectedWindows.setParentData(MainFileGrid.selectedItems);

The problem is that when I retrieved the list from the dialog, the list(hierarchical data) was sorted according to the way the selection was made in the main window. For example, if I selected bottom-up,it displayed folder first, if I selected up-to-bottom, it displayed file first.

How can I keep the default folder first display ?

1

There are 1 best solutions below

0
zawhtut On

I got it solved as the following

    public function setParentData(obj:Object):void{
        var tempArr:Array  = obj as Array;
        if(tempArr[0].Type == "file"){
            this.parentData = tempArr.reverse();
        }else{
            this.parentData = tempArr;
        }
    }