cancel
Showing results for 
Search instead for 
Did you mean: 

Calling View method from Class

0 Kudos

Hi,

Is it possible to call View method from 'Z' class so that I can modify some attributes of element (using view context)??

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Though it is not a good idea , because when you set the view property life time to 'when visible' the view instance will go for garbage collection.

you can save the view instance to the wddomodifyview view parameter to the component/view controller attribute and pass this instance to the class method for your further processing.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Ankit,

There is no way you can call a view method from a zclass or also from its component class or from anywhere as views are meant to be private in nature and there wont be access to any of view's elements and main point here is generally for performance issues write your methods in component controller and call from view.

Instead there is other way you can call a method into zclass,'create a customized class with method in the component and call it else create a custom method and change its required attributes in your current class'.

0 Kudos

thanks everyone for your suggestions.....

points awarded!!

0 Kudos

Hi Kuldeep,

thanks for response, if you check WDR_TEST_UI_ELEMENTS application - in it everything is controlled from assistance class........I want to change 'progress indicator' element value based on processing in class so that user is aware of program in running state (something very common in R/3 programs).

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You shouldn't need access to view to do this. When you call the method of the class, have it return or export the value in question. Then in the surrounding controller code, use that value to update the context bound to the UI element.

You want to have a nice separtion of the layers in your application. If you start passing around the view reference you run into technical problems as well as messing up the layering effect.

Former Member
0 Kudos

Hi Ankit

Calling a view method is not possible i think.

But You can make a assistance class for your WD component and then you can call your method in view , perhaps you can write the code to be changed in method of assistance class and then can modify it according to your need.

regards

Kuldeep

Abhinav_Sharma
Contributor
0 Kudos

Hi Ankit,

As far as I know, you can not access any view method directly. As views are generally not visible to outside component.

However, you can call Z class methods from view controller.

Regards

Abhinav

Edited by: Abhinav Sharma on Apr 1, 2011 3:16 PM