我想用mxml在flex中擴展標準DataGrid組件。但是我想將按鈕添加到組件的底部。我試圖嘗試以下,但它不工作...擴展DataGrid組件,並向其添加按鈕
我是否將Button添加到錯誤的元素?
<mx:DataGrid xmlns:fx = "http://ns.adobe.com/mxml/2009"
xmlns:mx = "library://ns.adobe.com/flex/mx"
xmlns:s = "library://ns.adobe.com/flex/spark">
<fx:Script>
<![CDATA[
override protected function createChildren():void
{
super.createChildren();
listContent.addChild(button);
}
]]>
</fx:Script>
<s:Button id="button" label = "asdasdas"/>
</mx:DataGrid>
我不明白這是如何回答你的問題的。這實際上不會將該按鈕添加爲DataGrid的子項;並且在你的問題的原始代碼中,你根本沒有在ActionScript中添加子代。 – JeffryHouser 2011-02-10 13:48:49