【问题标题】:Move/reorder columns in a spark DataGrid (Adobe Flex)在 spark DataGrid (Adobe Flex) 中移动/重新排序列
【发布时间】:2012-04-06 14:27:38
【问题描述】:

我无法找到 spark DataGrid 是否支持移动/重新排序列。 如果不是,最好的解决方案是什么?也许使用mx版本?

我希望用户能够拖动列并排列它们。

【问题讨论】:

  • 您的意思是通过拖动列重新排序吗?

标签: apache-flex flex-spark


【解决方案1】:

来自 Adob​​e Flex 4.6 - Spark DataGrid 控件,配置列:
http://help.adobe.com/en_US/flex/using/WS0ab2a460655f2dc3-427f401412c60d04dca-8000.html

注意:您只能以编程方式对 DataGrid 的列进行排序 通过对传递给 columns 属性的 IList 进行排序。那是你 无法使用鼠标拖动列来重新排列列。

因此,您需要一个编程实现来对 IList 列中的 GridColumn 重新排序。

    <s:columns> 
        <s:ArrayList>
            <s:GridColumn dataField="Album"/> 
            <s:GridColumn dataField="Price"/> 
        </s:ArrayList>
    </s:columns> 

【讨论】:

  • 谢谢,那么我有 2 个必须调查的解决方案,!从 spark 扩展 DataGrid 或 2 使用 mx DataGrid 。有什么建议吗?
【解决方案2】:
   //adg is your DataGrid id
   var tmp:ArrayList = adg.columns as ArrayList;
   var col:GridColumn = new GridColumn('customColumn'); //create new col or reuse existing from tmp
   tmp.setItemAt(col, 1); //set it at the position you want

【讨论】:

  • 我编辑了我的问题,我需要用户能够拖动列并移动它们,有什么提示吗?
  • 好吧...自己实现它或使用AdvancedDataGriddraggableColumns
【解决方案3】:

来自http://flex6packs.wordpress.com/2012/01/18/spark-grid-column-drag-and-drop-or-move/ 的costin 具有扩展DataGrid 以支持可拖动列的工作代码。

【讨论】:

    猜你喜欢
    • 2011-08-21
    • 2013-05-21
    • 2012-07-18
    • 2013-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-02
    • 2011-11-13
    相关资源
    最近更新 更多