on 09-10-2008 1:43 PM
Can someone clearly explain in words, what exactly is the difference between wdContext() and wdThis()
.When shud we use which one while we write the coding for the view and controller ??
Thanx in advance
Edited by: pankaj mathur on Sep 10, 2008 2:43 PM
Hi Pankaj,
wdContext refers to the root Context node of the component (e.g Views or Controllers)
wdThis refers to the component itself
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cud u plz explain in a little more detail
What do u exactly mean by the node of the component??
Is this true that wdThis is generally used during the View coding when the data is available at the view context.
Whereas wdContext() is used when the data is available at the controller context ??
Plz explain
Points will be given
Thanx
During coding, the most generic situations where these 2 are used are,
1. you have to use wdThis if you want to call an action, a method, or a event handler which is defined either in your view or in your controller.
2. you have to use wdContext if you want to "get" or "set" values from or to the "node" and "attribute" (it could be a model node, model attribute,value node or value attribute).
so your next question:
Is this true that wdThis is generally used during the View coding when the data is available at the view context. Whereas wdContext() is used when the data is available at the controller context ??
- this is not true, if you understand the above mentioned 2 points.
Hi Pankaj,
wdContext refers to the root Context node of the component i.e Context of Views or other Controllers
wdThis refers to the component itself ( Views or other Controllers)
When should we use which one while we write the coding for the view and controller ??
Whether in View or Controller,
if you want to refer any context attributes or nodes we use wdContext.
//to refer node
wdContext.node<nodename>() ;
//to refer attribute
wdContext.currentContextElement().get<attributename> ();
If you want to use any of the component's methods we use wdThis.
//to call a method
wdThis.<methodname>();
// you can get reference of the component controller in the view //like
wdThis.wdGet<Controllername>();
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.