2 Replies Latest reply on Oct 2, 2009 11:11 AM by sebaedata

    How to call function from a custom module in a grid?

    sebaedata

      I have a module with an advanced data grid in it. One of the columns of this grid has an itemRenderer="myCustom"

       

      MyCustom is a separate MXML Module. In this module, I have defined a vBox with 2 buttons. In the click event of the button how can I call a custom function that is defined in the parent module? click="myCustomFuction()" doesn't work and I get an 1180 warning . I'm thinking something like click="this.parent.myCustomFunction()" but I don't know the proper syntax.

        • 1. Re: How to call function from a custom module in a grid?
          Flex harUI Adobe Employee

          Object(this.owner).myCustomFunction

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: How to call function from a custom module in a grid?
            sebaedata Level 1

            I tried your suggestion, but it's not working. Can you figure out what I'm doing wrong?

             

            <mx:Button name="bLotView" label="View" click="Object(this.owner).MyCustomFunction()"

             

            This button is contained in a VBox which is contained in it's own module: MyVBox

             

            In the "parent" MyGrid module I have an AdvancedDataGrid and one of the columns of this grid uses ItemRender="MyVBox"

             

            If I place a button in the parent MyGrid module (not in the grid), and set it's click to MyCustomFunction() then the function fires. But the function never fires from the MyVBox module's button click which is contained in the grid.

             

            Does Object(this.owner) refer to the owning module or the owning control? If it refers to the owning control, wouldn't this point to the VBox in the same module, not the owning module? Would I have to do something like Object(this.owner.owner.owner).MyCustomFunction()  ??