【问题标题】:Flex DataGrid - how to find the maximum value in a column?Flex DataGrid - 如何找到列中的最大值?
【发布时间】:2011-01-15 08:08:47
【问题描述】:

如何在 Flex DataGrid 的特定列中找到最大值?

【问题讨论】:

    标签: apache-flex datagrid


    【解决方案1】:

    我认为没有标准的功能/解决方案。 一种解决方法可能是对列进行排序并获取可以从中提取最高值的结果。同样,这似乎没有标准功能。

    更多关于排序的信息可以在here找到。 不知道这是否是您希望的答案,但我希望它有所帮助:)

    【讨论】:

      【解决方案2】:

      datagrid的dataprovider可以是arraycollection。如果你对arraycollection进行排序,那么你将在第一行得到最大值。

      【讨论】:

        【解决方案3】:

        我遍历我的数据以找到最高值。

        我将第一行的值设置为您要搜索的特定列。 设置后,我将下一行与该值进行比较并重置变量,如果 它的价值更高。

        for (var y:int = 0; y < myData.length; y++)
        {
            if(y == 0)    // initialize the first value
            {
                YourVariableHolder = myData.getItemAt(y).YourValue;     
            }
        
            // Compare the previous value to the current value in the loop
            if(myData.getItemAt(y).YourValue > YourVariableHolder)
            {
                YourVariableHolder = myData.getItemAt(y).YourValue;
            }
        }
        

        【讨论】:

          猜你喜欢
          • 2011-06-22
          • 1970-01-01
          • 2020-12-02
          • 1970-01-01
          • 1970-01-01
          • 2019-05-23
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多