0 Replies Latest reply on Aug 10, 2010 6:12 AM by sweezy241

    Datagrid and binding

    sweezy241 Level 1

      Hello everyBody,

       

      I'm  here because i'm trying to create my first Flex application.

      And This is my Problem.

      I  use a Datagrid and  i want to keep the value of the The Selected Item.

      So in order to reach that goal i use The Binding  and this is my code :

       

       

          <fx:Binding source="Dt_travaux_current_projet.selectedItem as Travaux" destination="travaux"/>

       

          <mx:DataGrid x="75" y="144" id="Dt_travaux_current_projet" creationComplete="Dt_travaux_current_projet_creationCompleteHandler(event)" dataProvider="{getTravauxByProjectIDResult2.lastResult}" width="745">
                      <mx:columns>
                          <mx:DataGridColumn headerText="trv_id" dataField="trv_id"/>
                          <mx:DataGridColumn headerText="bat_id" dataField="bat_id"/>
                          <mx:DataGridColumn headerText="typetrv_id" dataField="typetrv_id"/>
                          <mx:DataGridColumn headerText="tra_trv_id" dataField="tra_trv_id"/>
                          <mx:DataGridColumn headerText="pj_id" dataField="pj_id"/>
                          <mx:DataGridColumn headerText="trv_libelle" dataField="trv_libelle"/>
                          <mx:DataGridColumn headerText="trv_date_debut" dataField="trv_date_debut"/>
                          <mx:DataGridColumn headerText="trv_date_fin" dataField="trv_date_fin"/>
                          <mx:DataGridColumn headerText="trv_montant_previsionel" dataField="trv_montant_previsionel"/>
                          <mx:DataGridColumn headerText="trv_montant_reel" dataField="trv_montant_reel"/>
                          <mx:DataGridColumn headerText="trv_commentaire" dataField="trv_commentaire"/>
                          <mx:DataGridColumn headerText="trv_encours" dataField="trv_encours"/>
                          <mx:DataGridColumn headerText="trv_Avancement" dataField="trv_Avancement"/>
                      </mx:columns>
                  </mx:DataGrid>

       

          <mx:FormItem label="Trv_id">
                          <s:TextInput id="trv_idTextInput" text="{travaux.trv_id}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Bat_id">
                          <s:TextInput id="bat_idTextInput" text="{travaux.bat_id}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Typetrv_id">
                          <s:TextInput id="typetrv_idTextInput" text="{travaux.typetrv_id}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Tra_trv_id">
                          <s:TextInput id="tra_trv_idTextInput" text="{travaux.tra_trv_id}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Pj_id">
                          <s:TextInput id="pj_idTextInput" text="{travaux.pj_id}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_libelle">
                          <s:TextInput id="trv_libelleTextInput" text="{travaux.trv_libelle}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_date_debut">
                          <mx:DateField id="trv_date_debutDateField" selectedDate="{travaux.trv_date_debut}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_date_fin">
                          <mx:DateField id="trv_date_finDateField" selectedDate="{travaux.trv_date_fin}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_montant_previsionel">
                          <s:TextInput id="trv_montant_previsionelTextInput" text="{travaux.trv_montant_previsionel}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_montant_reel">
                          <s:TextInput id="trv_montant_reelTextInput" text="{travaux.trv_montant_reel}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_commentaire">
                          <s:TextInput id="trv_commentaireTextInput" text="{travaux.trv_commentaire}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_encours">
                          <s:TextInput id="trv_encoursTextInput" text="{travaux.trv_encours}"/>
                      </mx:FormItem>
                      <mx:FormItem label="Trv_Avancement">
                          <s:TextInput id="trv_AvancementTextInput" text="{travaux.trv_Avancement}"/>
                      </mx:FormItem>
                      <s:Button id="button" label="Envoyer" click="button_clickHandler(event)"/>
                  </mx:Form>

       

       

      I don't understant why it does'nt work. as far as the tuto are concercrned weed don't need more !!!!

      Sorry for my english i'm fench...