on 03-30-2010 1:40 PM
Hi,
I have defined an attribute under Attribute tab of Component controller. How to access this inside WDDOINIT of component controller or inside any custom method of any of my view.
Rgds
Sudhanshu
For Comp controller:
WD_THIS->ATTR
For View:
WD_COMP_CONTROLLER->ATTR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sudhanshu sharma,
please search the forum before posting your question, I believe there are many answers to your question out there.
Anyway, here you have an example of how to access a context attribute from within your component controller:
wd_this->attribute_name.
Hope it helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I was thinking about the advantages of encapsulation. In my last post, I forgot to mention that this applies for the scenario where you get the attribute value from your view.
It seems that you have some data in your component controller which you want to access in the view. Perhaps you should consider using context binding instead of attributes?
/Björn-Henrik
Hi,
You made a good point however my requirement doesn't make any impact on design. All i wanted was a boolean flag to check whether my itab is initial or not and then need to perform some action in diffrent methods of same view. Im currently using component attribute and it is fine for me now. Thank you so much Sanket, Elvez and all bloggers.
Rgds
Sudhanshu
>It seems that you have some data in your component controller which you want to access in the view. Perhaps you should consider using context binding instead of attributes?
Why suggest that you should use the context instead? The context should only be used if you need to data bind into the UI elements. Otherwise it is advisable from a performance standpoint to not use the context. The context comes with a considerable memory and processing overhead. Never use the context unless absolutely necessary for data binding. Otherwise use attributes of the controllers themselves or use some external class (like the assistance class) to hold such data.
Hi Thomas,
I fully agree with you. In my previous post I did not recommend using a context attribute for all cases (I did use the word "perhaps"). However, if it is bound to a UI element and used acrossed various views, I would probably go for a context attribute. This is not the case in this thread and therefore a context attribute should not be used.
/Björn-Henrik
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.