[Resolvido]ArrayCollection
boa tarde, to usando o flash builder 4 sou novato e tenho a seguinte dúvida:
como inserir dados em um datagrid por campos de formulário, sem banco de dados, só por código mesmo? tenho tentado aqui, mas não to tendo resultado.
segue abaixo meu código.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable] public var lista:ArrayCollection = new ArrayCollection([
{col1:"valor 1", col2:"valor 2", col3:"valor3"},
{col1:"valor 4", col2:"valor 5", col3:"valor6"}
]);//obrigatório usar [Bindable] e private para declar um ArrayColletion
protected function button1_clickHandler(event:MouseEvent):void
{
//COLOCAR O COMANDO AQUI DENTRO
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:DataGrid x="49" y="26" dataProvider="{lista}" id="grid">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
<mx:DataGridColumn headerText="Column 2" dataField="col2"/>
<mx:DataGridColumn headerText="Column 3" dataField="col3"/>
</mx:columns>
</mx:DataGrid>
<mx:Form x="359" y="26">
<mx:FormItem label="col1">
<s:TextInput id="c1"/>
</mx:FormItem>
<mx:FormItem label="col2">
<s:TextInput id="c2"/>
</mx:FormItem>
<mx:FormItem label="col3">
<s:TextInput id="c3"/>
</mx:FormItem>
<s:Button label="enviar" click="button1_clickHandler(event)"/>
</mx:Form>
</s:Application>Discussão (3)
Carregando comentários...