Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.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
Apache flex Flex:数据库驱动的DataGrid:箭头消失_Apache Flex_Actionscript 3_Flex Datagrid - Fatal编程技术网

Apache flex Flex:数据库驱动的DataGrid:箭头消失

Apache flex Flex:数据库驱动的DataGrid:箭头消失,apache-flex,actionscript-3,flex-datagrid,Apache Flex,Actionscript 3,Flex Datagrid,在Flex中,我使用以下代码允许在DataGrid中进行排序,数据在服务器端分页和排序 private function headerReleaseHandler(event:DataGridEvent):void { var column:DataGridColumn = DataGridColumn(event.currentTarget.columns[event.columnIndex]); if(this.count>0

在Flex中,我使用以下代码允许在DataGrid中进行排序,数据在服务器端分页和排序

private function headerReleaseHandler(event:DataGridEvent):void { var column:DataGridColumn = DataGridColumn(event.currentTarget.columns[event.columnIndex]); if(this.count>0) { if(this.query.SortField == column.dataField) { this.query.SortAscending = !this.query.SortAscending; } else { this.query.SortField = column.dataField; this.query.SortAscending = true; } this.fill(); } event.preventDefault(); } 这工作得很好,只是没有显示指示排序的箭头。我怎样才能做到这一点

谢谢!
/Niels

如果这是您要寻找的,这里有一个例子:


看起来您需要刷新数据提供商使用的集合。

如果这是您正在寻找的,这里有一个示例:


看起来您需要刷新数据提供商使用的集合。

在上述代码中,这指的是数据网格,因为我对此感到困惑。query.SortField,我假设“this”和“query”是您自己的自定义对象。你为什么要检查计数呢。那算什么

问候
-Mohan

在上面的代码中,这指的是数据网格,因为我被this.query.SortField弄糊涂了,我假设“this”和“query”是您自己的自定义对象。你为什么要检查计数呢。那算什么

问候
-Mohan

我遇到了同样的问题,我找到的唯一解决方案是覆盖DataGrid并创建一个自定义的。 下面是课堂:

public class DataGridCustomSort extends DataGrid
{

    public function DataGridCustomSort()
    {
        super();

        addEventListener(DataGridEvent.HEADER_RELEASE,
            headerReleaseHandlerCustomSort,
            false, EventPriority.DEFAULT_HANDLER);
    }       

    public function headerReleaseHandlerCustomSort(event:DataGridEvent):void {
        mx_internal::sortIndex = event.columnIndex;
        if (mx_internal::sortDirection == null || mx_internal::sortDirection == "DESC")
            mx_internal::sortDirection = "ASC";
        else
            mx_internal::sortDirection = "DESC";
        placeSortArrow();
    }

}

在获取HEADER_RELEASE事件并设置列索引和方向信息时,必须专门调用placeSortArrow方法

我遇到了同样的问题,我找到的唯一解决方案是覆盖DataGrid并创建一个自定义的。 下面是课堂:

public class DataGridCustomSort extends DataGrid
{

    public function DataGridCustomSort()
    {
        super();

        addEventListener(DataGridEvent.HEADER_RELEASE,
            headerReleaseHandlerCustomSort,
            false, EventPriority.DEFAULT_HANDLER);
    }       

    public function headerReleaseHandlerCustomSort(event:DataGridEvent):void {
        mx_internal::sortIndex = event.columnIndex;
        if (mx_internal::sortDirection == null || mx_internal::sortDirection == "DESC")
            mx_internal::sortDirection = "ASC";
        else
            mx_internal::sortDirection = "DESC";
        placeSortArrow();
    }

}
在获取HEADER_RELEASE事件并设置列索引和方向信息时,必须专门调用placeSortArrow方法