telerik - javascript closure, not working? -


i have function call retrieve sliding pane (telerik splitter control) thought use function

function getzone() {         var slidingzone = $find("<%= slidingzone.clientid %>");         return function () { return slidingzone; };     } 

so didn't have "find" sliding zone every time. doesn't work.

this does...

function getzone() {         var slidingzone = $find("<%= slidingzone.clientid %>");         return slidingzone;     } 

can tell me why first 1 isn't working?

btw, i'm using this....

function hidetreepane() {         var paneid = "<%= slidingpane.clientid %>";         getzone().undockpane(paneid);         return true;     } 

well, first function, returns function, , want inner function executed.

if invoke result of see work, e.g.:

getzone()(); 

i think want following, use executed anonymous function, call $find method once, storing result:

var getzone = (function() {   var slidingzone = $find("<%= slidingzone.clientid %>");   return function () { return slidingzone; }; })(); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -