cancel
Showing results for 
Search instead for 
Did you mean: 

calling view method

Former Member
0 Kudos

Hi ,

How to call a method in the view from component controller.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Subscribe the view controller to a component controller event and fire the event in the component controller.

Armin

Former Member
0 Kudos

Hi Bharath

In your view where ever you want to use the method of component controller use this line of code

wdThis.wdGet<your component controller>Controller().<method in Component Controller>();

Best Regards

Chaitanya.A

Former Member
0 Kudos

Hi Chaitanya,

You told me the reverse way. actually I want to call method in the view from component controller ?

Former Member
0 Kudos

Hi Bharath

Custom Controllers[Even a component controller is a custom controller] have a public interface ,but view controllers do not. therefore a view controller can decalre the use of custom controller, but not vice versa

Best Regards

Chaitanya.A

former_member485701
Active Participant
0 Kudos

Hi Bharath,

(1)Create an event in component controller. and a method "notifyEvent" to fire this event

public void notifyEvent( ) {

//@@begin notifyEvent()

wdThis.wdFireEventEvent();

//@@end

}

(2)Create an event handler for this event in view.

write your code there.

(3)Now on some action in view call "notifyEvent" method of component controller.

wdThis.wdGet<componentName>Controller().notifyEvent();

And it will automatically call your view's method.

I hope this will solve your problem

For any question regarding this, feel free to contact.

Regards,

Praveen

Former Member
0 Kudos

Hi Praveenkumar,

Thanks for the info....,I already used this kind of code but Instead of using notofy event() method,I used a normal method in component controller to fire the event. Based on the condition ,I am calling this method ,it inturns firing that event.

I have created a eventhandler method in the view which is subscribed to this event.

But now the problem is the View is not initialised when this method is executed in the component controller. What should I do? help me out.

What is the difference in using a notifyevent() and normal method to fire the event?

Thanks in advance.

Bharath

former_member485701
Active Participant
0 Kudos

Hi bharath,

I am confused here by your statement that view is not initialized.

If view is not initialized the how are u firing the event of the component controller.

(1)create an event. (comp controller)

(2)create a method to fire this. (comp controller)

(3)now call this method in view after view is initialized (may be on some action)

(4)And then your view's event handler will be automatically called for this.

Can you please write the steps you followed?

.

Regards,

Praveen

Former Member
0 Kudos

Hi Praveen,

Thanks for the reply.........,Actually in my program there are diff. DC's .

In the component controller itself we are moving to another DC...,If that DC calls this DC again,at that time we are calling this view...,

Now how can I initialize the view with out going to another DC?

former_member485701
Active Participant
0 Kudos

ok..

(1)When you used one DC in the other it it has a field Lifecycle (create on Demand or manual) ..

then choose manual there.

(2)Emebed the interface view for used DC in your window.

(3)Now in your view controller add the used component in the required controller.

(4)and when you want to initialize the view of other DC.

wdThis.wdGetUsedComponentUsage().createComponent();

Regards,

Praveen

Former Member
0 Kudos

Hi praveen,

I just want to initialize the view in the present ,I mean in 1st DC itself when I fire the event in the 1st DC component controller...,will u plzzz help me out?

Message was edited by:

Bharath Akuthota

former_member485701
Active Participant
0 Kudos

Hi,

The problem is coming because wdDoinit of comp controller is called first and the view controller's wdDoinit() is called.

I think you are firing the event in the wdDoInit() of component controller.

Dont fire the event from wdDoinit of comp controller.

For testing purpose you can do one thing. create one button in the view and in the action of this button fire the event.

I hope it should work for you.

Regards,

Praveen