1 Reply Latest reply on Jun 30, 2008 6:05 AM by Karl_Sigiscar_1971

    A Click on DataGrid Row takes you to a new page/layer

    Kenwio Level 1
      Hi!
      I want to achieve this:
      I'd like to program a DataGrid so when I click on a row in the DataGrid it would take me to a new page/layer that contains information related to the row I clicked on.

      Does anyone know how to achieve this?
      //K
        • 1. Re: A Click on DataGrid Row takes you to a new page/layer
          Karl_Sigiscar_1971 Level 3


          You should use a viewstack and set its selectedIndex property in the change handler of the datagrid.

          private function dataGridChangeHandler(event:Event):void
          {
          // Get selected datagrid row item
          var selectedPage:uint = event.target.selectedIndex;

          // Set the view stack index
          this.pagesStack.selectedIndex = selectedPage;
          }

          ...

          <mx:HBox width="100%" height="100%">

          <mx:Datagrid width="50%" change="this.dataGridChangeHandler" />

          <mx:ViewStack id="pagesStack" width="50%">

          <mx:Canvas
          id="page 1"
          showEffect="Fade"
          hideEffect="Fade"/>

          </mx:ViewStack>

          </mx:HBox>