Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sorting 按两列排序datagrid将删除排序箭头_Sorting_Apache Flex_Dataprovider_Columnheader - Fatal编程技术网

Sorting 按两列排序datagrid将删除排序箭头

Sorting 按两列排序datagrid将删除排序箭头,sorting,apache-flex,dataprovider,columnheader,Sorting,Apache Flex,Dataprovider,Columnheader,我使用的是Flex版本3.6,我需要按两列对数据网格进行排序。单击列标题时,排序箭头显示在其上方 我现在要做的是,当我点击一个特定的列时,它将在两个列上排序。那部分起作用了 但我注意到,通常出现在已排序列上的排序箭头指示器已消失。我使用的是DataGrid的一个子类,所以在排序之后,我尝试使用placeSortArrow(),但我注意到在DataGridHeader中,sortArrow为空 protected function headerReleaseListener(event:DataG

我使用的是Flex版本3.6,我需要按两列对数据网格进行排序。单击列标题时,排序箭头显示在其上方

我现在要做的是,当我点击一个特定的列时,它将在两个列上排序。那部分起作用了

但我注意到,通常出现在已排序列上的排序箭头指示器已消失。我使用的是DataGrid的一个子类,所以在排序之后,我尝试使用
placeSortArrow()
,但我注意到在DataGridHeader中,
sortArrow
为空

protected function headerReleaseListener(event:DataGridEvent):void
{
    if(event.columnIndex == 0)
    {
        event.preventDefault();

        var sort:Sort = new Sort();
        sort.fields = [new SortField("@name",true, true), new SortField("@address",true, false)];

        ArrayCollection(this.dataProvider).sort = sort;
        ArrayCollection(this.dataProvider).refresh();
    }
}

我想要的是指定排序箭头应该出现在哪一列上,一列是按1列还是按多列排序。有人知道这是否可行吗?

我从另一个问题中找到了消失的排序箭头的答案:在一个由回答的问题中,并根据我的代码对其进行了修改

因为排序了两列,所以内部
sortIndex
为-1,因此sortArrow为空

通过选择一列来显示排序(我使用了主排序列)并设置排序索引和方向,现在会出现
sortArrow

protected function headerReleaseListener(event:DataGridEvent):void
{
    if(event.columnIndex == 0)
    {
        event.preventDefault();

        var sort:Sort = new Sort();
        sort.fields = [new SortField("@name",true, true), new SortField("@address",true, false)];

        ArrayCollection(this.dataProvider).sort = sort;
        ArrayCollection(this.dataProvider).refresh();

        mx_internal::sortIndex = event.columnIndex;

        mx_internal::sortDirection = (mx_internal::sortDirection == null || mx_internal::sortDirection == "ASC") ? "DESC" : "ASC";

        placeSortArrow();
    }
}