on 11-30-2007 2:26 PM
Hi ,
How to call a method in the view from component controller.
Thanks
Subscribe the view controller to a component controller event and fire the event in the component controller.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
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
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.