2 Replies Latest reply on Jul 25, 2011 3:51 AM by j@i

    error in getting popup on datagrid selected item

    j@i

      hi every one,

       

      i'm a beginer.I'm trying to get popup on seleted item on datagrid with seleted data.

      but when i'm trying to trying to get popup instence in main app. i'm getting error which i have mentioned in the below code in bold .

      could any one plz help me out.

       

      main Application:

       

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

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

         xmlns:s="library://ns.adobe.com/flex/spark"

         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

         creationComplete="application1_creationCompleteHandler(event)">

       

       

      <fx:Declarations>

      <!-- Place non-visual elements (e.g., services, value objects) here -->

      </fx:Declarations>

       

       

      <fx:Script>

      <![CDATA[

          import mx.collections.ArrayCollection;

      import mx.events.FlexEvent;

      import mx.managers.PopUpManager;

       

       

      [Bindable]

      public var data:ArrayCollection = new ArrayCollection;

       

      protected function application1_creationCompleteHandler(event:FlexEvent):void

      {

      data = new ArrayCollection([{id:'1', name:'John'},

      {id:'2', name:'Alex'},{id:'3', name:'Peter'},

      {id:'4', name:'Sam'},{id:'5', name:'Alis'},{id:'6', name:'Robin'},

      {id:'7', name:'Mark'},{id:'8', name:'Steave'},{id:'9', name:'Fill'},

      {id:'10', name:'Abraham'},{id:'11', name:'Hennery'},{id:'12', name:'Luis'},

      {id:'13', name:'Herry'},{id:'14', name:'Markus'},{id:'15', name:'Flip'}]);

       

      }

       

       

      public var newPopUp:popUpForm;

       

      protected function myDG_clickHandler(event:MouseEvent):void

      {

      var dataObj:Object = new Object();

       

      dataObj.id = myDG.selectedItem.id;

      dataObj.name = myDG.selectedItem.name;

       

       

       

      var newPopUp:popUpForm = new popUpForm(PopUpManager.createPopUp(this, popUpForm, true));

       

      /*error showing is incorrect number of argumnents ,expecting no more than 0 */

       

       

      }

       

       

      ]]>

      </fx:Script>

      <s:Group width="100%" height="100%" verticalCenter="0" horizontalCenter="0">

      <s:DataGrid id="myDG" dataProvider="{data}" width="40%" requestedRowCount="5"

      doubleClickEnabled="true" click="myDG_clickHandler(event)">

      <s:columns>

      <s:ArrayCollection>

      <s:GridColumn dataField="id" headerText="ID"/>

      <s:GridColumn dataField="name" headerText="Name"/>

      </s:ArrayCollection>

      </s:columns>

      </s:DataGrid>

       

      </s:Group>

      </s:Application>

       

       

       

      popUpForm component:

       

       

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

      <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"

         xmlns:s="library://ns.adobe.com/flex/spark"

         xmlns:mx="library://ns.adobe.com/flex/mx" close="titlewindow1_closeHandler(event)">

       

      <fx:Script>

      <![CDATA[

      import mx.events.CloseEvent;

      import mx.managers.PopUpManager;

       

      protected function titlewindow1_closeHandler(event:CloseEvent):void

      {

      PopUpManager.removePopUp(this);

       

      }

       

      ]]>

      </fx:Script>

       

       

      <fx:Declarations>

      <!-- Place non-visual elements (e.g., services, value objects) here -->

      </fx:Declarations>

       

      <s:VGroup>

      <s:Form id="form">

      <s:FormItem>

      <s:Label id="idLable" text="ID : "/>

      <s:Label id="idText" />

      </s:FormItem>

      <s:FormItem>

      <s:Label id="nameLable" text="Name : "/>

      <s:Label id="nameText" />

      </s:FormItem>

      </s:Form>

      </s:VGroup>

      </s:TitleWindow>