本文介绍了如何在AdvancedDataGrid中获取标题列的列索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户单击标题时,我想知道AdvancedDataGrid
中标题的列索引-左键单击还是右键单击.
I want to know column index of header in AdvancedDataGrid
when a user clicks on header - either left click or right click.
推荐答案
AdvancedDataGrid
调度headerRelease
事件.此事件具有从零开始的 columnIndex 属性
AdvancedDataGrid
dispatches a headerRelease
event when you click on its header. This event has a zero based columnIndex property.
但是有一个问题:仅当单击的列是可排序的,并且数据提供程序支持排序.
There is one problem though: The headerRelease
event is dispatched only if the clicked column is sortable and the data provider supports sorting.
<mx:AdvancedDataGrid headerRelease="handleHeaderClick(event)">
<!-- Columns and stuff -->
</mx:AdvancedDataGrid>
<mx:Script>
<![CDATA[
private function handleHeaderClick(event:AdvancedDataGridEvent):void
{
var index:Number = event.columnIndex;
}
]]>
</mx:Script>
这篇关于如何在AdvancedDataGrid中获取标题列的列索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!