我正在创建一个Flex表,其中一列可编辑。我想限制用户对某些字符的输入。以下代码给出了Could not resolve <s:itemEditor> to a component implementation
错误。任何人都知道如何解决这个问题?
...
<fx:Array>
<supportClasses:MyColumn ... />
<supportClasses:MyColumn editable="true" ...>
<s:itemEditor>
<fx:Component>
<s:TextInput restrict="0-9a-zA-Z"/>
</fx:Component>
</s:itemEditor>
</supportClasses:MyColumn>
<supportClasses:MyColumn ... />
...
</fx:Array>
...
MyColumn是一个类,其功能如下:
import spark.components.gridClasses.GridColumn;
public class MyColumn extends GridColumn
{
...
public function MyColumn(headerText:String="header" width:Number=100 ...)
{
this.headerText=headerText;
...
}
}
答案 0 :(得分:1)
问题是当命名空间不匹配(supportClasses:
和s:
)时,mxml编译器会感到困惑。修复非常简单:
<supportClasses:MyColumn editable="true" ...>
<supportClasses:itemEditor>
<fx:Component>
<s:TextInput restrict="0-9a-zA-Z"/>
</fx:Component>
</supportClasses:itemEditor>
</supportClasses:MyColumn>