How to dispatch custom events from an item renderer used for Datagrid Column

Hi,
I am using an Item Renderer for a Data Grid Column and in that mxml, I am dispatching a custom event with data.
But the main mxml which has the DataGrid is not able to resolve the event. How can I solve this?
Thanks

Hi,
This is the constructor for Event.
public function Event(type:String, bubbles:Boolean  = false, cancelable:Boolean  = false)
When you created your custom event after extending from Event, for the parent container receives the event, the bubbles property must be set to true.
Please check if you have done so. That should solve the problem. Let me know if it doesn't.
Nishad

Similar Messages

  • Dispatch custom event from itemClick handler

    hi,
    I'm trying to dispatch a custom event from my itemClick handler.
    So when I click on an item of my datagrid, I want to send a custom event.
    private function dataGridItemClickHandler( event:ListEvent): void
         dispatchEvent( new myEvent( myEvent.NEW, values[event.columnIndex]["name"]) );
    <mx:DataGrid dataProvider="{values}" itemClick="dataGridItemClickHandler(event)">
    </mx:DataGrid>
    but this code doesn't work.
    Can you help me
    thanks
    best regards

    Please see that you override the function clone() and return the new function.If that is correct.you can call the super() method to initialize your base class.
    If your custom event {myEvent} is in package say: CustomEvent,
    1)import package CustomEvent.myEvent
    2) keep in <mx:metadata>[Event(name="NEW", type="CustomEvent.myEvent")]</mx:metadata>.. name suggest  what type of event you want
    3)Create an itemclick listener and in dataGridItemClickHandler
    private function dataGridItemClickHandler( event:ListEvent): void
         dispatchEvent( new myEvent( ' NEW ', values[event.columnIndex]["name"]) );
    private funcation myEventListener(evt:myEvent):void
    //Put your logic
    4)Use this event by name NEW="myEventListener(event)"  this will behave as event type in the datagrid tag like click, hover and others.
    Hope this helps! Please excuse if anything is logically incorrect.Do point out.Thanks.

  • How to dispatch an event from the application to the preloader

    HI everyone
                     I've been searching everywhere on the net, and as far as it goes I gotten no answer for this. When the application hit the preinitialize phase, I'm calling the loadStyle method. As you can see I will hold the CreationComplete event until I the swf is ready. What I want to do, is to have a second loading bar in the preloader (no problem here) to show the progress of the swf downloaded, hence the StyleEvent.PROGRESS event. I would like to know how can I dispatch that event to the preloader?
    ///////////////////APPLICATION
                  import mx.events.StyleEvent;
                import mx.styles.StyleManager;
                private function loadStyle():void
                        var eventDispatcher:IEventDispatcher = StyleManager.loadStyleDeclarations("cl/elmelej/mangiare/estilo/estilo.swf");
                        eventDispatcher.addEventListener(StyleEvent.COMPLETE, completeHandler);
                        eventDispatcher.addEventListener(StyleEvent.PROGRESS,progreso);  
                private function completeHandler(event:StyleEvent):void
                        super.initialized = true;
                private function progreso(event:StyleEvent):void
                override public function set initialized(value:Boolean):void
                    // Hold off until the Runtime CSS SWF is done loading.
    ///////////////////////////////////PRELOADER
    virtual public function set preloader(value:Sprite):void
                _preloader = value;
                value.addEventListener(ProgressEvent.PROGRESS, progressHandler);   
                value.addEventListener(Event.COMPLETE, completeHandler);
                value.addEventListener(StyleEvent.PROGRESS, progressHandlerCSS);  
                value.addEventListener(FlexEvent.INIT_PROGRESS, initProgressHandler);
                value.addEventListener(FlexEvent.INIT_COMPLETE, initCompleteHandler);
    As you can see, the preloader is listening to StyleEvent.PROGRESS  events, but I cant dispatch that event to the preloader so that it can react to it. I hope you can help me. Thanks for your time and help
    Sebastián

    Alex,
             Thank you very much for the fast answer, but I'm not an advanced programmer in Flex, so I would need a bit more help from you. I wouldlike you to tell me if it is possible to do what I want to do? and could you be more specific n the information you gave me please?
    I think you mean something like this:
    private function progreso(event:StyleEvent):void
                  (this.systemManager.getChildAt(systemManager.numChildren) as Preloader).getChildAt(XXXXXXXX).dispatchEvent(event)
    /////////////////////// (this.systemManager.getChildAt(systemManager.numChildren) as Preloader)) -------->gets the preloader 
    ///////////////////////(this.systemManager.getChildAt(systemManager.numChildren) as Preloader).getChildAt(XXXXXXXX)     -------------> would get the progressbar (only If I have XXXXXvalue)      
    let me tell you that the method that I posted on the last message was a part of this class:
         public class PreloaderDisplayBase extends Sprite implements IPreloaderDisplay
    PreloaderDisplayBase is my Preloader.
    I hope you can help me.
    Thanks Again
    Sebastián Toro O

  • How to extract custom label from page item

    I´m trying to extract custom labels from a page item -a rectangle in this case-, inside a document observer:
         UIDRef pageItemRef=iCommand->GetItemList()->GetRef(0);
         InterfacePtr<IScript> script(pageItemRef,IID_ISCRIPT);
         IScriptLabel::ScriptLabelKeyValueList tags = script->GetTags();
    as sugested here -> http://forums.adobe.com/thread/747080?tstart=0  but I always get script=nil
    Regards

    I solved.
    Problem was that I was trying to get IScript interface once observer command was in kDone state -it was a delete command-.
    Thus, page items did not exist anymore when I was trying to get their custom labels.
    I changed it, making test during kNotDone state.
    Regards

  • Re:Item renderer AS3 for datagrid

    I am having a data grid with multiple check boxes for this i am using CheckCellRendererEdit as itemrenderer.When i am making a change in datagrid checkbox its not updating
    The problems are
    1. when i select a checkbox in second row it gets selected in another  row after saving
    2.when i choose one checkbox in a row it gets afftected in many row can i get a solution for this Below given is the code i am using
    CheckCellRendererEdit.as
    package
        import mx.controls.*;
    import mx.core.*;
    import mx.controls.dataGridClasses.DataGridListData;
    import flash.events.Event;
    import flash.events.MouseEvent;
    public class CheckCellRendererEdit extends CheckBox
    // Define the constructor and set properties.
    public function CheckCellRendererEdit() {
        super();
    override protected function clickHandler(event:MouseEvent):void
                if (!enabled)
                {    //DataGrid(this.parentDocument.dg).selectedItem.vdata=CheckBox(event.currentTarget).selec ted;
                        event.stopImmediatePropagation();
                        return;
                if (toggle)
                    selected = !selected;

    Currently i am migrating from flex1.5 to flex2 Just i am using this itemrenderer(checkbox) for DataGrid can i have some ideas for datagrid
    The DataGrid i am using is
    <mx:DataGrid id="screendg" ">
                <mx:columns>
                  <mx:Array>
                    <mx:DataGridColumn headerText="mdata" dataField="screenid" editable="false" />
                    <mx:DataGridColumn headerText="data" dataField="mdata" itemRenderer="CheckCellRendererEdit"  />
                    <mx:DataGridColumn headerText="mdata" dataField="vdata" itemRenderer="CheckCellRendererEdit"  />
                    <mx:DataGridColumn headerText="cdata" dataField="cdata" itemRenderer="CheckCellRendererEdit"  />
                    <mx:DataGridColumn headerText="vdata" dataField="udata" itemRenderer="CheckCellRendererEdit"  />
                </mx:Array>
                </mx:columns>
              </mx:DataGrid>
    When i am selecting a checkbox in data grid the grid value is not getting changed

  • Dispatching an event from a command

    Hi,
    In one for my commands in the Cairngorm based application I'm working on I need to dispatch a event to amend the view. In my command I'm amending some value objects in a ArrayCollection, which is the data source for a List component in my view. Once I completed my changes to these value objects I'd like to dispatch a event to resort the ArrayCollection and update my view to the new order.
    What is the best approach for dispatching an event in the command?
    Thanks
    Stephen

    Great question - I'm currently sorting out how to do this myself.  I'm new to Cairngorm but have a decent amount of experience with Flex.  Here are my thoughts:
    Cairngorm promotes decoupling of the data model and front controller/commands from the view - which is appropriate for an MVC framework. Data binding supports this seperation (to an extent) and keeps the view up to date with the model in 'real time'.  Data binding does not however provide an intuitive mechanism for reacting to cairngorm event results.  So here a few solutions I've been tossing around:
    1.  Rely on Built in Flex events such as the datagrid's dataChange event to trigger a reaction.
    2.  Create view state variables in the model that, when changed through the front controller / commands, dispatch custom events from within their VO's / setters / ect.
    3.  Dispatch custom events directly from front controller / commands.
    4.  Create custom (or override existing) item renderers that self-transition / tween when changed as a result of data binding.
    I'm sure there are other ways to do what we want, but I'm out of ideas.  Which approach to take very well depends on how strongly you'd like to adhere to the MVC concept.  Commands that dispatch generic events as their messages may or may not be acceptable to you - but they provide a straitforward way to trigger view related reactions without relying on data binding events.  I'd be interested to know if Cairngorm 3 will address this challenge...
    Let me know what you decide on if and when you make a choice!

  • Can you send custom events from one form to another?

    I have a compli
    cated application, where I about hundred inp
    uts organized in several input forms. Some of the forms
    require data which has been input in other forms. I have tried to
    dispatch custom events from one form to another, but it dispatches the
    whole form and I only need one or two items.
    Ha anybody else come across such a problem?
    Svend

    One way is to share data in a static singleton

  • Dispatching an event from a MovieClip???

    Hello, can somebody tell me if there is a way to dispatch an
    event from a Movieclip?, I tried to dispatch an event from a class
    and all ran ok. But now, if I have a Movieclip on my scenario and I
    want that when it arrive to "x" frame it dispatch an event that
    could be catched by a listener on the _root, what I have to do?
    (without doing use of classes), thanks a lot.

    Try the following. On the first frame of the movieclip place
    the following code.
    // Event Routines //
    var dispatchEvent:Function;
    var addEventListener:Function;
    var removeEventListener:Function;
    mx.events.EventDispatcher.initialize(this);
    Then on the "x" frame of the movieclip, place the following
    code:
    var evt:Object = new Object();
    evt.type = "framereached"; // this can be whatever you wish
    to listen for
    evt.target = this;
    dispatchEvent(evt);
    This is how you would do this in a class and it should work
    just as well if coded directly onto a frame. However, to make this
    more versatile I would place it in a class with a public function,
    for example, name throwEvent(). This public method would then
    execute the above code and could be called from any frame. You
    could even add another item to the evt object that would contain
    the frame the executed the event.
    Tim

  • How to Access Custom Event using AS3?

    Hi All,
    Maybe it's that its Monday morning and my brain is still foggy, but I can't seem to figure out how to set custom events using AS3.
    I have a custom GridRow itemRenderer, and have declared the event using the appropriate metatags.
    Then I create the GR item dynamically using AS3 instantiation, but the event is not available for selection in the intellisense drop-down.
    Let's take the following as an example:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Grid
         xmlns:mx="http://www.adobe.com/2006/mxml"
         xmlns:renderers="com.brassworks.renderers.*"
         creationComplete="componentInit();"
    >
         <mx:Script>
              <![CDATA[
                   private function componentInit():void
                        newRow     :MyRow     = new MyRow();
                        //newRow.myEvent is not an available option to set
              ]]>
         </mx:Script>
    </mx:Grid>
    Then the itemRenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <GridRow
         xmlns:mx="http://www.adobe.com/2006/mxml"
         xmlns:classes="com.brassworks.components.classes.*"
         creationComplete="componentInit();"
    >
         <mx:Metadata>
              [Event(name="myEvent", type="flash.events.Event")]
         </mx:Metadata>
         <mx:Script>
              <![CDATA[
                   private function itemChanged(event:Event):void
                   Alert.show("test");
                   this.dispatchEvent(new Event("myEvent"));
              ]]>
         </mx:Script>
         <mx:GridItem>
              <mx:TextInput
                   change="itemChanged"
              />
         </mx:GridItem>
    </GridRow>
    How do I go about setting the handler method for custom events on instantiated items? Do I need to do this via the AddEventListener() method? Does this mean that events aren't exposed in ActionScript like they are in MXML? (In MXML all I have to do is <MyRow myEvent="handler(event)" />.)
    Thanks!
    -Mike

    Yes, I you need to do this via the addEventListener() method.
    myRow.addEventListener( "myEvent", myHandler );
    I hope that helps.
    Ben Edwards

  • How to define custom event and how to trigger the defined event

    hi,guys
    hurry issue....................hope get help.
    I am using oracle weblogic 10gr3 portal.and we choiced java portlet.as of now,we got some question about custom Event.hope you can give some idea....
    thank you so much.
    question detail:
    1.for java portlet ,how to define custom event.
    2.how to trigger this event.
    3 about the data,may be sometime need to transit Biz data.
    auctully,I just want to implements between two portlets communicate.
    for example:
    existing portletA,portletB.
    portletA is a list,like:
    A AA <button>
    after I click this buttom,then portletB will be effect,it means they are interact with each other.
    does anybody hit this issue before,if you solved pls share me .
    thank you for you help....

    Hello,
    Please note that everything below applies to JSR168 portlets ONLY- JSR286 portlets and other portlet types handle events a little differently.
    From inside your JSR168 portlet you can send an event during processAction or when receiving another event by using the PortletBackingContext object, such as:
    import javax.portlet.ActionResponse;
    import javax.portlet.ActionRequest;
    import javax.servlet.http.HttpServletRequest;
    import com.bea.netuix.servlets.controls.portlet.backing.PortletBackingContext;
    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
    HttpServletRequest httpRequest = (HttpServletRequest) actionRequest.getAttribute("javax.servlet.request");
    PortletBackingContext portletBackingContext = PortletBackingContext.getPortletBackingContext(httpRequest);
    portletBackingContext.fireCustomEvent("customEvent", "This is a custom event");
    To receive an event, in your .portlet file you just need to put in a "handleCustomEvent" tag specifying which method to call when the event is received, such as:
    <?xml version="1.0" encoding="UTF-8"?>
    <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
    xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd">
    <netuix:javaPortlet title="Listening Portlet" definitionLabel="yourPortletName">
    <netuix:handleCustomEvent event="customEvent" eventLabel="customEvent" filterable="true" description="custom event handler">
    <netuix:invokeJavaPortletMethod method="processCustomEvent"/>
    </netuix:handleCustomEvent>
    </netuix:javaPortlet>
    </portal:root>
    Then, in your receiving portlet the method "processCustomEvent" would receive the event, such as:
    public void processCustomEvent(ActionRequest actionRequest, ActionResponse actionResponse, Event event)
    The event payload can be any Serializable object you want, but for forward-compatibility with JSR286 it would be ideal if it had a valid JAXB binding.
    Kevin

  • Dispatching Custom Events Help

    Hello Everyone,
    I am just learning how to handle custom events, and after spending couple of days tring to understand the process, I am unable to get it going. What I am trying to do is to write a Two Button (component/swf). So when I need to utilize this component in other projects, I can simply load the the swf and be able to fire the buttons.
    I have two button objects on the stage, and I would like these two button object to fire custom events when the parent component is loaded as swf in other projects. Perhaps, I am going all wrong about what I am tring to accomplish here, I would highly appreciate your help.
    After some research, I concluded that I will need to employ Custom Event(s) going for my component. I spent hours on google and have not been able to get it working.
    Here is my code:
    ============================
    CustomEvent Class
    ============================
    package com.custom.apps
        import flash.events.Event;
        public class CustomEvent extends Event
            public static const CUSTOM:String = "custom";
            public var arg:*;
            public function CustomEvent(type:String, customArg:*=null, bubbles:Boolean=false, cancelable:Boolean=false)
                super(type, bubbles, cancelable);
                this.arg = customArg;
            public override function clone():Event
                return new CustomEvent(type, arg, bubbles, cancelable);
            public override function toString():String
                return formatToString("CustomEvent", "type", "arg",    "bubbles", "cancelable", "eventPhase");
    ============================
    DISPATCHING THE EVENTS
    ============================
    import com.custom.apps.*;
    btn.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(e:MouseEvent):void
        dispatchEvent(new Event(CustomEvent.CUSTOM, customHandler));
        //trace("FIRED");
    function customHandler(e:CustomEvent):void
        trace(e.target);
        trace('hello');

    Kalisto,
    I appreciate your help. Do I have this right? So I can build a navigation component with two links:
    LINK1 | LINK2
    then I load this navigation component/swf into another project and when I click on either of the links, it will dispatch a CUSTOM EVENT and when the event is dispatched, lets say I have a  function (sayHello) listening for that particular event and when the CUSTOM EVENT is dispatched when one of the navigation component's link is clicked the (sayHello()) function would fire itself.
    Can this be done? Am I on the right track?
    I have been at it for couple of days now, I am able to dispatch the event but don't know how to have a function listen for the events. I would highly appreciate it if you can have look at my code.
    Thanks a lot

  • How to get a value from one item into another

    How can i get value from one item into another item.
    Ex: I have a report, in there i have check boxes, and when i have checked some rows, and press submitt, a prosses computates it into a item on another page, and a branche redirects to page 3. Then i'm going to use the value in the item into a PL/SQL script in an report to show the submittet items.
    How can i do this?
    Computation script, pages and all that is fixed. But i dont know which PL/SQL statement to use to get th value from the item.

    Hi Fredr1k,
    Use the V() function from pl/sql.
    e.g. V('P3_MY_ITEM')
    will return the value of that page item.
    As long as the pl/sql is called from within the Apex environment.
    Regards
    Michael

  • How can I remove events from my iPhone. I want to delete all the events from my iPhone.

    how can I remove Events from my Photo in iPhone

    Connect to computer iTunes and uncheck under Photos > Events then do a sync.

  • Issue in using custom event from outreach

    Hi
    I have created a custom event and executed a scenario successfully for this custom event from ACC. But when I try to configure the same event from Outreach(BCC), I am able to see this custom event in the list of available events, but after selecting this event there is no option to configure attributes for this event, but I can configure attributes in ACC. My BCC version is 10.1.1
    Edited by: 1002715 on Apr 26, 2013 3:06 AM

    Dear Ankit,
    Once the pricing procedure is downloaded, please maintain the document pricing procedure at service contract header level, and maintain the customer pricing procedure at business partner sales area billing data.
    In spro, maintain the pricing procedure for the combination of sales area, document pricing procedure, customer pricing procedure.
    Please crosscheck whether the condition table is active or not.
    Regards,
    Maddy

  • How to raise an event from a program

    Hi,
    I am creating a workflow for HR, the person will request a basic pay change than, this will start the workflow. For this i am making a screen from where i need to triger the event for the workflow.
    Does anybody has any idea? of how to raise an event from a program. or has anybody worked on a scenario like this
    Khusro Habib

    You can also use the FM SAP_WAPI_CREATE_EVENT which is a little newer I think. (I don't have access to a system today so that may not be the exact name of the FM but if you search SE37 under SAPWAPIEVENT* you should find it.
    the parameters will be the event name, and the object key.  The object key will be the key field of the workflow object you are using. 
    For example if you were using the saled document object then the object key would be the sales document number.  Carefull how you enter the object key, it can be a little tricky on whether or not you need the leading zeros in the input parameter. 
    Hope this helps.
    Brent

Maybe you are looking for

  • Peculiar case of GR posting

    HI I have tried posting the same problem but no one could answer, may be because I was not clear in asking my question ....this is the question and best possible way to ask  it... We have a particular requirement for a type of subcontracting process

  • HT201272 All my previously purchased iTunes Music will not play on my iPhone 5. I am really frustrated! If anyone knows how to help, please do so :)

    I cannot play any of my previously purchased iTunes songs/albums on my iPhone 5. The songs are listed as downloaded, but when I go to play them, the 'play' screen appears for about 2 seconds, and then disappears. I have followed all the steps I can f

  • Navigation iView source

    Hi all, I know the position of SDN and this kind of question shouldn't exist. But with the time pressure, we need to implement something pretty the same as Navigation iView but with some extra functionalities, for example display html files stored in

  • Concurrent LRUCache?

    Hi, I'd like to know if you know of an LRU (least recently used) cache that would use java.util.concurrent. I'm currently using the following implementation that is based on java.util.LinkedHashMap. Do you know if there is an implementation based on

  • Windows 8.1 email App (Metro)

    Is it possible to change the Metro email app from the default live.com account you get to an Office 365 account? I have an O365 account with my own domain which is <user>@domain.com. When I setup Win 8.1 I sign in with my O365 account - <user>@domain