PDA

View Full Version : Here's when javascript rules



d0uble_hel1x
13 Aug 2007, 7:26 AM
i was working on Ext.View and i came across a situation when i needed to access variable in view.prepareData but i was loosing the scope. then out of frustration i tried the below and it worked like a charm:

this.view = new Ext.View(
this.GridID,
new Ext.Template('some html text')),
{store: this.ds,
singleSelect:true,
autoScroll:true
loadMask:true,
Caller : this} //<inserted this>
);

this.view.prepareData = function(data){
return {
SomeValue : this.Caller.SomePublicVariable + data.abc ;
...};
};
return;