2 Replies Latest reply on Apr 26, 2007 11:56 PM by rajeeva_nagaraj

    Datagrid; howto get selected object attrs

    Fred in Orlando
      My data looks like this
      <employee >
      <shift id="1">
      <date>Sun 3-25</date>
      <in0 id="122" >8:00am</in0>
      <in1 id="333" >12:40</in1>
      <out1 id="1234">5:40</out1>

      The datagrid displays the time in the <in1> tag just fine, but when the user clicks on this cell, I need to be able to get the "id" attribute in order to update the DB.

      I'm a newbie and am trying to redo a dojo project in flex. I'm not locked in to the xml pattern shown above. Otherwise my datagrid is working well. snippet below...

      <mx:DataGrid id="punchdetail" itemClick="punchSelected(event);"
      <mx:DataGridColumn dataField="id" visible="false" />
      <mx:DataGridColumn dataField="date" headerText="Date"/>
      <mx:DataGridColumn dataField="in0" width="50" headerText="In" />
      <mx:DataGridColumn dataField="out0" width="50" headerText="Out"/>
      <mx:DataGridColumn dataField="total" />
      private function punchSelected(event:ListEvent):void {
      var col:DataGridColumn = punchdetail.columns[event.columnIndex];
      Alert.show ( " "+punchdetail.selectedItem.col.dataField);
      //Alert.show ( " "+col.dataField);
      //Alert.show ( " "+punchdetail.selectedItem.valueOf());