List Itemrenderer problem for ItemrenderView and itemrendererMediator class.

rasel200209's Avatar

rasel200209

11 May, 2011 05:52 AM

1.MainContext.as
override public function startup(): void
{ mediatorMap.mapView(ItemrenderView, itemrendererMediator );
} 2.Container.mxml
<s:List itemRenderer="ItemrenderView "/>
3.itemrendererMediator.as

public override function onRegister():void
    {

}

now i am adding a component to List by using drag and drop.
Sometimes, onRegister() function executes of itemrendererMediator when creating an instance of ItemrenderView
in list itemrenderer. sometimes, onRegister() function doesnot call.
That means mediator class are not correctly mapped always with itemrenderer class.
How can I resolve the problem?

NB. This part is a separate module from main application. When we are loading this module in the main application, we inject the parentInjector to this modules's inject.

  1. Support Staff 1 Posted by Stray on 11 May, 2011 08:16 AM

    Stray's Avatar

    Hi there -you're actually having the same problem as Tony in this thread, which is also active:

    http://knowledge.robotlegs.org/discussions/problems/312-a-modules-m...

    So - do you want to join us in there? I think the stuff that has been explained might help you.

    Stray

  2. 2 Posted by rasel200209 on 11 May, 2011 08:51 AM

    rasel200209's Avatar

    thanks for your reply. I have read your link. But for my problem,
    it always happen, seems not like that.
    When I drag and drop my view component to the List, sometimes, the itemrendererViewMediator class of that itemrendererView, instantiate successfully, sometimes mediator class are not called for the itemrendererView, and the component are not registered. So why sometimes call mediator class and sometimes not?
    and it is uncertain.....

  3. Support Staff 3 Posted by Stray on 11 May, 2011 08:52 AM

    Stray's Avatar

    It is I think the same as the other discussion - in that your best bet is to override preRegister and find out what is happening.

  4. 4 Posted by rasel200209 on 11 May, 2011 09:20 AM

    rasel200209's Avatar

    i have use Alert() in mediator class constructor, and mediator class are not called.... so override preRegister(), it would do any?

    Actually, when i am running this module as individual project and

    override public function startup(): void
        {
    

    injector.mapValue(IInjector, injector);
    } use this as its own injector then it works fine. no problem.

    but we are following http://joelhooks.com/2010/05/02/modular-robotlegs/
    for our project modularization programming.
    and we inject the parentInjector the the modules like..

        public function DashboardContext(contextView:DisplayObjectContainer, parentInjector:IInjector)
        {       
            super(contextView, true, parentInjector);
        }
    
        override public function startup(): void
        {
    

    //there is no injector }

    so my problem relates to injector communication??

  5. 5 Posted by Stray on 11 May, 2011 09:29 AM

    Stray's Avatar

    It does sound like that's your problem.

    The reason to override preRegister is that onRegister is only run after certain things happen in flex - so, if you read the thread I pointed you at - there is a way of using preRegister to trace out things, so that you can find out whether the mediatorMap has even created the mediator and run preRegister.

    But, if your injector doesn't exist... hmmm - I'd dig further around that.

    Stray

  6. Stray closed this discussion on 25 May, 2011 08:34 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac