1 Reply Latest reply on Jan 28, 2007 10:43 AM by Peter Lorent

    Generating a Page based on the selections

    centralperks
      Ok,

      So my last post got no help, so here is something that maybe someone out there can help me with. I have been google'n for days and cannot find this done anywhere.

      I would like a user to select an item from a combo box.
      then a list populates from that selection into a datagrid.
      the user would then select a choice from the data grid
      The selection that the user makes would be a link and would take them to another page in the same window _self or a seperate window. I dont really care.

      Pretty simple i think , but i just cannot figure it out.
      please please please someone help.

      I could really use it .

      I have the PHP code and the databases working i just dont know how to make that content clickable in the data grid.

      Thanks
      CH
        • 1. Re: Generating a Page based on the selections
          Peter Lorent Level 2
          >> i just dont know how to make that content clickable in the data grid

          When you click a cell in the grid, an event gets fired: cellPress. You respond to that event using a listener object. Define a function on the listener object with the same name as the event and in the function use getURL() to open a website.

          Assuming you have a dataprovider for the grid like:
          data_array=[{school:"Boston Public",grade:"excellent",id:1,url:" http://www.bostonpublic.com"}

          You can hide columns if you want: (set this before you assign the dataprovider)
          my_datagrid.columnNames=["school","grade"];
          now set the dataprovider for the grid
          my_datagrid.dataProvider=data_array;

          and setup a listener for the cellPress event
          var my_listener:Object=new Object();
          my_listener.cellPress=function(evtObj:Object):Void{
          //open the website of the school
          getURL(data_array[evtObj.itemIndex].url,"_blank");
          }
          my_datagrid.addEventListener("cellPress",my_listener);

          cellPress passes an object containing:
          columnIndex: A number that indicates the index of the column that was pressed. The first position is 0.
          itemIndex: A number that indicates the index of the row that was pressed. The first position is 0.
          type: The string "cellPress".

          So we use the itemIndex to get the url from the dataprovider.