我正在使用一些自定义组件构建一个 Flex 应用程序,我认为这会搞砸事情。我正在尝试sortByColumn
在火花数据网格中,使用此处的答案作为模板。当我尝试在函数中使用以下内容时,
myGrid.sortByColumns(0,true);
我得到错误:
1061: Call to a possibly undefined method sortByColumns through a
reference with static type com.components:MyReportGrid.
有谁知道如何消除这个错误?是否MyReportGrid
以某种方式掩盖了火花组件的正确位置?在使用其他一些函数(例如 invalidateCell())时,我也会收到“未定义的方法”错误,不确定它是否与此错误有关。
我的数据网格如下所示:
...
<components:MyReportGrid id="myGrid" dataProvider="{_myData}"...>
<components:columns>
<fx:Array>
<supportClasses:MyColumn ... />
<supportClasses:MyColumn ... />
<supportClasses:MyColumn ... />
...
其中 MyColumn 是一个类,如下所示:
import spark.components.gridClasses.GridColumn;
public class MyColumn extends GridColumn
{
...
public function MyColumn(headerText:String="header" width:Number=100 ...)
{
this.headerText=headerText;
...
}
}
MyReportGrid 是:
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="400" height="300">
import com.components.myClasses.MyColumn;
import com.itemRenderers.myItemRenderer;
import mx.collections.ArrayCollection;
import mx.collections.ArrayList;
import mx.collections.ListCollectionView;
import spark.components.gridClasses.GridColumn;
...
<s:DataGrid width="100%" ... />
</s:Group>