代码之家  ›  专栏  ›  技术社区  ›  Martin

灵活数据报-如何在列中找到最大值?

  •  2
  • Martin  · 技术社区  · 15 年前

    如何在flex数据报的特定列中找到最大值?

    3 回复  |  直到 9 年前
        1
  •  2
  •   michael    15 年前

    DataGrid的DataProvider可以是ArrayCollection。如果您对arraycollection进行排序,那么您将在第一行得到最大值。

        2
  •  1
  •   MysticEarth    15 年前

    我认为没有一个标准的函数/解决方案来解决这个问题。 解决方法可能是对列进行排序,并获得可以从中提取最大值的结果。再说一次,似乎没有一个标准的函数。

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

        3
  •  0
  •   mmvsbg    9 年前

    我循环查看我的数据以找到最高的值。

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

    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;
        }
    }
    
    推荐文章