1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default function inside function

    function inside function


    Hi,
    How i will call a function from another function:
    like:
    Code:
    onRenderSubRegion : function(component) {
            var subRegionStore = Ext.data.StoreManager.lookup('deliveryGroupPerformances.SubRegionStore');
             subRegionStore.load({
                 params : {region : "All"},
                 scope : this,
                 callback : function(){
                   this.defaultSubRegion();//working fine
                      }
                  });
    
        },
    defaultSubRegion : function(){
        selectedSubRegion.length = 0;
        var subRegionStore = Ext.data.StoreManager.lookup('deliveryGroupPerformances.SubRegionStore');
         maxSubRegion = subRegionStore.getCount();
         subRegionStore.queryBy(function(record) {
                    selectedSubRegion.push(record.get('subRegion'));
    setDisplayField();//unable to call the function
            });
     setDisplayField : function(selected,displayFieldId,max){
    alert(1);
    }
      },

  2. #2
    Sencha User Legolas's Avatar
    Join Date
    Apr 2010
    Location
    Brazil/MG
    Posts
    58
    Vote Rating
    3
    Legolas is on a distinguished road

      0  

    Default


    chandan.behura, try this:
    Code:
    onRenderSubRegion : function(component) {
        var subRegionStore = Ext.data.StoreManager.lookup('deliveryGroupPerformances.SubRegionStore');
         subRegionStore.load({
            params : {region : "All"},
            scope : this,
            callback : function(){
                this.defaultSubRegion();//working fine
            }
        });
    },
    defaultSubRegion : function(){
        selectedSubRegion.length = 0;
        var me = this, // Reference to your class
            subRegionStore = Ext.data.StoreManager.lookup('deliveryGroupPerformances.SubRegionStore');
        maxSubRegion = subRegionStore.getCount();
        subRegionStore.queryBy(function(record) {
            selectedSubRegion.push(record.get('subRegion'));
            me.setDisplayField();//unable to call the function
        });
    }
    setDisplayField : function(selected,displayFieldId,max){
        alert(1);
    }

    I am sorry my english, I am learning yet
    Portuguese blog: http://wessdevel.blogspot.com.br/
    Twitter: @wlegolas

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default


    Thanks for ur reply. It worked fine.

    But unable to do for the bellow situation.
    Code:
    onShowCountry : function() {
             Ext.select('.x-mask').addListener(
                     {click:{fn:this.onClickCountry,single:true}});//calling to onClickCountry for click event
        },
    onClickCountry : function(){
        var selection = Ext.getCmp('countryCheckgridId').getSelectionModel().getSelection();
        var countryDisplayField = Ext.getCmp('countryTip');
        selectedCountry.length = 0;
        for ( var index = 0; index < selection.length; index++) {
            selectedCountry.push(selection[index].data.country);
        }
    this.setDisplayField(selectedCountry,countryDisplayField);//unable to call setDisplayField
            countryPopUp.close();
            
        },
    
    setDisplayField : function(selected,displayFieldId){
    alert(1);
        },

  4. #4
    Sencha User Legolas's Avatar
    Join Date
    Apr 2010
    Location
    Brazil/MG
    Posts
    58
    Vote Rating
    3
    Legolas is on a distinguished road

      0  

    Default


    You can define the "scope" in you addListeners. Try this:
    Code:
    onShowCountry : function() {
         Ext.select('.x-mask').addListener({
            click: {
                fn:this.onClickCountry,
                single:true,
                scope: this // Here you define the scope
            }
         });
    },
    So in your method "onClickCountry" the scopo is your Classe.
    I am sorry my english, I am learning yet
    Portuguese blog: http://wessdevel.blogspot.com.br/
    Twitter: @wlegolas

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default


    Quote Originally Posted by Legolas View Post
    You can define the "scope" in you addListeners. Try this:
    Code:
    onShowCountry : function() {
         Ext.select('.x-mask').addListener({
            click: {
                fn:this.onClickCountry,
                single:true,
                scope: this // Here you define the scope
            }
         });
    },
    So in your method "onClickCountry" the scopo is your Classe.
    Thanks a lot. It worked fine.

    Can u tell me how i will use functions and variables of one controller inside another controller.
    I mean if i have 2 controller ,how i will able to use some functions and variables of 1st controller in second controller.

  6. #6
    Sencha User Legolas's Avatar
    Join Date
    Apr 2010
    Location
    Brazil/MG
    Posts
    58
    Vote Rating
    3
    Legolas is on a distinguished road

      0  

    Default


    chandan.behura, if I understand correctly, you want to use a method of controller X in controller Y. Has this UX Ext.ux.Router.
    I am sorry my english, I am learning yet
    Portuguese blog: http://wessdevel.blogspot.com.br/
    Twitter: @wlegolas

  7. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default


    Quote Originally Posted by Legolas View Post
    chandan.behura, if I understand correctly, you want to use a method of controller X in controller Y. Has this UX Ext.ux.Router.
    Thanks for your reply.
    I am unable to use the Ext.ux.Router(How to import the js file and use)
    But i am thinking of using
    var controller = this.getController("deliveryGroupPerformanceSummary.OtherFilterController");
    if (!controller) {
    // Something went bad...
    alert("Something went bad...");
    } else {
    // Call the method
    controller.someMethod();
    }


    Is this a good way.?

  8. #8
    Sencha User Legolas's Avatar
    Join Date
    Apr 2010
    Location
    Brazil/MG
    Posts
    58
    Vote Rating
    3
    Legolas is on a distinguished road

      0  

    Default


    Quote Originally Posted by chandan.behura View Post
    Thanks for your reply.
    I am unable to use the Ext.ux.Router(How to import the js file and use)
    chandan.behura, I never used this UX, but have an example in portuguese where explains how use this UX. Here is the link: http://www.sitedoricardo.com.br/cate...JS.aspx?page=3
    Quote Originally Posted by chandan.behura View Post
    But i am thinking of using
    var controller = this.getController("deliveryGroupPerformanceSummary.OtherFilterController");
    if (!controller) {
    // Something went bad...
    alert("Something went bad...");
    } else {
    // Call the method
    controller.someMethod();
    }

    Is this a good way.?
    This is a way, but I not think a good way.
    I am sorry my english, I am learning yet
    Portuguese blog: http://wessdevel.blogspot.com.br/
    Twitter: @wlegolas

  9. #9
    Sencha User
    Join Date
    Jul 2012
    Location
    India
    Posts
    87
    Vote Rating
    0
    Ronits is on a distinguished road

      0  

    Default


    Chandan,
    Create a custom controller object reference in the launch event of app.js ,like this :
    Code:
    launch: function () {
            appReference = this;
    This object will be available throughout the application.
    You can access any controller by using this :
    Code:
    appReference.getController('controller_name')
    where you define the controller being accessed as :
    Code:
    Ext.define('App.controller.controller_name
    Thanks,
    Ronz

  10. #10
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
    chandan.behura is on a distinguished road

      0  

    Default


    Quote Originally Posted by Ronits View Post
    Chandan,
    Create a custom controller object reference in the launch event of app.js ,like this :
    Code:
    launch: function () {
            appReference = this;
    This object will be available throughout the application.
    You can access any controller by using this :
    Code:
    appReference.getController('controller_name')
    where you define the controller being accessed as :
    Code:
    Ext.define('App.controller.controller_name
    can u say me how i will access a variable through more than one controllers.

    I have done like that in the controller
    defaultAllSelectedSubRegion : [],

    and unable to get the variable in the sane controller.
    by..
    this..defaultAllSelectedSubRegion.push(record.get('subRegion'));

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi