Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.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:如何在AdvancedDataGrid中隐藏行?_Apache Flex_Advanceddatagrid_Show Hide_Invisible - Fatal编程技术网

Apache flex Flex:如何在AdvancedDataGrid中隐藏行?

Apache flex Flex:如何在AdvancedDataGrid中隐藏行?,apache-flex,advanceddatagrid,show-hide,invisible,Apache Flex,Advanceddatagrid,Show Hide,Invisible,我有一个AdvancedDataGrid,它的数据提供者是ArrayCollection。例如,我有一个复选框,允许我显示或隐藏AdvancedDataGrid中的某些行 你知道我该怎么做吗?我的建议是使用数据提供程序的filterFunction属性。基本上,您可以为数据提供程序提供一个函数,该函数将确定ArrayCollection中的给定项是否被排除(如果某个项被排除,它将不会显示在AdvancedDataGrid中,本质上使其“不可见”)。可以找到filterFunction的文档 然后

我有一个AdvancedDataGrid,它的数据提供者是ArrayCollection。例如,我有一个复选框,允许我显示或隐藏AdvancedDataGrid中的某些行


你知道我该怎么做吗?

我的建议是使用数据提供程序的
filterFunction
属性。基本上,您可以为数据提供程序提供一个函数,该函数将确定ArrayCollection中的给定项是否被排除(如果某个项被排除,它将不会显示在AdvancedDataGrid中,本质上使其“不可见”)。可以找到
filterFunction
的文档

然后,我建议选中复选框在数据提供程序中的对象上设置一个属性,然后由筛选函数使用该属性包括/排除行。以下是一些(非常粗略的)伪代码:

private function checkboxClickHandler( event:MouseEvent ):void
{
    /*
       Based on the MouseEvent, determine the row 
       in the data grid you're dealing with
    */

    myDataProvider[someIndex].checkboxFlag = myCheckBox.selected;
    myDataProvider.refresh(); // calling refresh() re-applies the filter to
                              // account for changes.
}

private function myDataProviderFilterFunction( item:Object ):Boolean
{
     // assuming we want the item to be filtered if checkboxFlag is true
     return !item["checkboxFlag"];
}

我的建议是使用数据提供程序的
filterFunction
属性。基本上,您可以为数据提供程序提供一个函数,该函数将确定ArrayCollection中的给定项是否被排除(如果某个项被排除,它将不会显示在AdvancedDataGrid中,本质上使其“不可见”)。可以找到
filterFunction
的文档

然后,我建议选中复选框在数据提供程序中的对象上设置一个属性,然后由筛选函数使用该属性包括/排除行。以下是一些(非常粗略的)伪代码:

private function checkboxClickHandler( event:MouseEvent ):void
{
    /*
       Based on the MouseEvent, determine the row 
       in the data grid you're dealing with
    */

    myDataProvider[someIndex].checkboxFlag = myCheckBox.selected;
    myDataProvider.refresh(); // calling refresh() re-applies the filter to
                              // account for changes.
}

private function myDataProviderFilterFunction( item:Object ):Boolean
{
     // assuming we want the item to be filtered if checkboxFlag is true
     return !item["checkboxFlag"];
}