1 Reply Latest reply on Apr 17, 2008 9:31 AM by camfieldaj

    populate textInput from DataGrid

    sxp001
      Please help!
      My DataGrid has "FIELD_NAME" and "FIELD_VALUES" columns.
      My TextInput objects has to match id names from "FIELD_NAME" columns, and populate value from "FIELD_VALUES" column into text.
      How I can do this?
      Thank you very much!
      Slava
        • 1. Re: populate textInput from DataGrid
          camfieldaj Level 1
          Sorry for the messed up cut and paste.

          private function itemClickEvent(event:ListEvent):void
          {
          if(event.columnIndex < 0)
          {
          //can't do anything
          }
          else
          {
          var selectedVIPName:String=event.currentTarget.selectedItem.VIPName;
          var selectedVIPAddress:String=event.currentTarget.selectedItem.VIPAddress;
          var selectedExternalAddress:String=event.currentTarget.selectedItem.ExternalAddress;
          var selectedvid:String=event.currentTarget.selectedItem.vid;

          vipname_inp.text=String(selectedVIPName);
          vipaddress_inp.text=String(selectedVIPAddress);
          external_inp.text=String(selectedExternalAddress);
          vid_inp.text=String(selectedvid);
          }
          }

          <mx:DataGrid id="dg" dataProvider="{lc}" width="100%" height="100%" rowHeight="20" itemClick="itemClickEvent(event);" >
          <mx:columns>
          <mx:DataGridColumn headerText="VID" dataField="vid" visible="False" />
          <mx:DataGridColumn headerText="VIP Name" dataField="VIPName" />
          <mx:DataGridColumn headerText="VIP Address" dataField="VIPAddress"/>
          <mx:DataGridColumn headerText="External Address" dataField="ExternalAddress"/>
          </mx:columns>
          </mx:DataGrid>