4 Replies Latest reply on Oct 2, 2006 1:30 AM by ljonny18

    delete row + dataGrid + button

    ljonny18
      Hi

      I am trying to add a button to a dataGrid and assign it a value from the dataProvider in Flex

      For example I have a dataGrid that displays my data, and I have added a button “delete” which when is selected needs to get the ID of the selected row so it can delete the correct / selected dataGrid row etc….

      I have included the button in the dataGrid as a component which is fine, but I am having trouble assigning the button a value etc.

      <mx:DataGrid id="testDG" dataProvider=”…” >

      <mx:columns>
      <mx:DataGridColumn dataField="a" headerText="B"/>
      <mx:DataGridColumn dataField="b" headerText="B"/>
      <mx:DataGridColumn dataField="c" headerText="C"/>

      <mx:DataGridColumn id="deleteButtonCol">
      <mx:itemRenderer>
      <mx:Component>
      <mx:Button label="Delete" click="need to call a function here and pass the row ID"/>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>

      </mx:DataGrid>

      As it is in a component object I think it cannot communicate with any scripts outside of this component…???? Has it something to do with “coupling flex components” allowing them to communicate.

      Can anyone give me any advise on how to go about this?

      Thanks,
      Jon.