0 Replies Latest reply on Jun 2, 2012 12:12 PM by 56231

    Button and button function on separate pages. Possible?

    56231

      I have a datagrid with a dataProvider supplied by an arrayCollection. Each row has a cell filled with an edit button and three cells filled with info. The edit button is in a separate editBtn.mxml file via itemRenderer because that's the only way I could make it work. I am trying to get the edit button for each row to copy the three values in that row to three variables.

       

      editBtn.mxml gives error (call to undefined method editBtnHandler). editBtnHandler function is defined in the first mxml page where the datagrid is located.

       

      How do I resolve this to make these pages communicate? Or is this not the way it should be done? Thanks.

       

      private function editBtnHandler(event:Event):void {

              var favorite:String = event.target.selectedItem;

              mx.controls.Alert.show("favorite="+ favorite);

      }

       

      <mx:DataGridColumn itemRenderer="editBtn"/>

       

      editBtn.mxml

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Button xmlns:mx="http://www.adobe.com/2006/mxml"

          label="Edit Button"

          click="editBtnHandler(event)"

      />