Flex : How to link data to a datagrid ?
Posted
by Tristan
on Stack Overflow
See other posts from Stack Overflow
or by Tristan
Published on 2010-06-09T16:41:33Z
Indexed on
2010/06/10
0:42 UTC
Read the original article
Hit count: 369
Hello,
I'm following flex tutorials but i'm not doing exactly as they do, so :
What i want
I have an input text, with a button 'search'.
I want when this button is clicked that the data returned by the function search are displayed in the datagrid.
What i have :
The text input :
<s:TextInput includeIn="DetailServeurs" x="58" y="361" width="209" id="txt_search" text="Default text" focusIn="txt_search_focusInHandler(event)"/>
a Search button :
<s:Button includeIn="DetailServeurs" x="275" y="361" label="Rechercher" id="btn_rechercher" click="btn_rechercher_clickHandler(event)"/>
a clickhandler for this search button :
protected function btn_rechercher_clickHandler(event:MouseEvent):void
{
if(txt_search.text != ""){
getServeurByNameResult.token = serveurService.getServeurByName(txt_search.text);
}
}
and a datagrid :
<mx:DataGrid includeIn="DetailServeurs" x="30" y="124" width="1002" height="179" id="dataGrid" dataProvider="{getServeurByNameResult.lastResult}">
<mx:columns>
<mx:DataGridColumn headerText="GSP_nom" dataField="GSP_nom"/>
<mx:DataGridColumn headerText="port" dataField="port"/>
........
</mx:columns>
</mx:DataGrid>
So how can i display the results in the datagrid ? Thanks ! ;)
© Stack Overflow or respective owner