-
3 Mar 2013 5:53 PM #1
scope problem
scope problem
I want to reach variable outside the proxy. It is red colored below. How can I use this variable "this" pointer does not work. Thank you..
Code:Ext.define('Confman.view.AuthorPaperList', { extend:'Ext.grid.Panel', xtype:'authorPaperList', width:222, height:300, testID: 15, //store : 'AuthorPaperList', store:{ fields: [{name: 'name',}, {name: 'paperId'} ], proxy: { type: 'ajax', url : 'Servlet', extraParams: { requestType : testID}, reader: { root: 'rows' } }, autoLoad: true },
-
3 Mar 2013 6:02 PM #2
You're essentially doing this:
It won't be evaluated correctly.Code:var o = { a: 1, b: { c: a } };
Instead:
Code:Ext.define('Confman.view.AuthorPaperList', { extend:'Ext.grid.Panel', xtype:'authorPaperList', width:222, height:300, testID: 15, initComponent: function() { this.store = { fields: [{name: 'name',}, {name: 'paperId'} ], proxy: { type: 'ajax', url : 'Servlet', extraParams: { requestType : this.testID}, reader: { root: 'rows' } }, autoLoad: true }; this.callParent(); }Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
3 Mar 2013 6:28 PM #3
I stated in my question, ' "this" pointer does not work' , I have also tried it. However, here the problem is trying to reach an outer scope which is generally imposibble in programming languages. I just wonder whether we can use up, down functions or not.
-
3 Mar 2013 6:33 PM #4
Please read the code I posted again and try it, it has a different structure to what you're using.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
4 Mar 2013 2:39 AM #5
Hmm, ok, I did not see initComponent sorry, I will try it, thanks


Reply With Quote