Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

Hybrid View

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    27
    Answers
    3
    Vote Rating
    0
    arcan9ne is on a distinguished road

      0  

    Question Answered: Ext.application and Ext.override in launch function does not work?

    Answered: Ext.application and Ext.override in launch function does not work?


    I'm moving towards the ExtJS 4.0 MVC architecture and I had an override in my old init method which worked:

    Old code that worked:
    Code:
    APP.app = function() {
    ...
      return {
        init: function() {
          Ext.QuickTips.init();
          
          Ext.override(Ext.Ajax.request, {
            extraParams: {
              param_1: Ext.get('my_id').getValue(),
              param_2: Ext.get('my_id_2').getValue(),
              param_3: Ext.get('my_id_3').getValue()
            }
          });
        }
      }
    }
    
    Ext.onReady(APP.app.init, APP.app);
    New code that doesn't
    Code:
    Ext.application({
      name: 'APP',
      autoCreateViewport: true,
      launch: function() {
        Ext.override(Ext.Ajax.request, {
          extraParams: {
            param_1: Ext.get('my_id').getValue(),
            param_2: Ext.get('my_id_2').getValue(),
            param_3: Ext.get('my_id_3').getValue()
          }
        });
      }
    });
    As you can see, I've moved this override to the launch function. You will also realize that I am retrieving my values from elements in the page after it has been loaded which is the reason for applying the override in the launch function.

    Any help would be much appreciated.

  2. I got it working: I've moved the above code with the Ext.override directive to the launch function of the application, like you did:
    Code:
    Ext.application({
      ...
      launch: function() {
        Ext.data.proxy.Server.override({
          ...
        });
        ...
      }
    });
    First, it did not work either. Then I switched the ExtJS library from ext.js to ext-debug.js in the HTML header:
    Code:
    <script src="extjs/ext-debug.js" type="text/javascript"></script>
    And it magically worked!

    So I guess, in order to use ext.js again (for the final apllication version), there is something missing, maybe one has to require a specific class, which I'm not aware of?

  3. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    27
    Answers
    3
    Vote Rating
    0
    arcan9ne is on a distinguished road

      0  

    Default


    My other thought would be to add a listener for when the page is loaded, but I don't see any events specific Ext.app.application. Are there any?

  4. #3
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    7
    Answers
    1
    Vote Rating
    0
    remeis is on a distinguished road

      0  

    Default


    Hi,

    basically, I've the same problem: I'd like to override Ext.data.proxy.Server such that it will react on a failed request:
    Code:
    Ext.data.proxy.Server.override({
      constructor: function() {
        console.log('overriden data.proxy.Server constructed');
        return this.callOverridden(arguments);
      },
    
      afterRequest: function(request, success) {
        if (! request.operation.success) {
          console.log('request failed');
        }
      }
    });
    This works if I put this code directly above the store definition in the corresponding store file (app/store/myStore.js). Because I'd like to apply this to every store (in app/store) it would make sense to override the class in the main application file (app.js). But above the application definition doesn't work:
    Code:
    <-put the code above here does not work->
    
    Ext.application({
      name: 'myApp',
      appFolder: 'app',
      ...
    )};
    I will continue working on this problem.

  5. #4
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    7
    Answers
    1
    Vote Rating
    0
    remeis is on a distinguished road

      0  

    Default


    I got it working: I've moved the above code with the Ext.override directive to the launch function of the application, like you did:
    Code:
    Ext.application({
      ...
      launch: function() {
        Ext.data.proxy.Server.override({
          ...
        });
        ...
      }
    });
    First, it did not work either. Then I switched the ExtJS library from ext.js to ext-debug.js in the HTML header:
    Code:
    <script src="extjs/ext-debug.js" type="text/javascript"></script>
    And it magically worked!

    So I guess, in order to use ext.js again (for the final apllication version), there is something missing, maybe one has to require a specific class, which I'm not aware of?
    Last edited by remeis; 21 Oct 2011 at 12:07 AM. Reason: typos in code section

  6. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    27
    Answers
    3
    Vote Rating
    0
    arcan9ne is on a distinguished road

      0  

    Default


    Thanks a lot remeis, that worked for me as well! I will do some further testing and if I figure out what is missing then will post the solution using ext-all.js.

  7. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,477
    Answers
    523
    Vote Rating
    280
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    I think the most widely used technique for applying overrides in ExtJS 4 is:

    Code:
    Ext.require('classname', function() {
        // Callback for when the class has been loaded. Apply the overrides here.
    });
    This would be placed before the call to Ext.application().

    I'm a bit confused by the use of Ext.override() to set extraParams on Ext.Ajax.request. I don't really understand how that ever worked. As far as I can tell it'll be setting the extraParams on the prototype of the request function. Unless you're doing something really odd like new Ext.Ajax.request({...}) I can't see why they'd get picked up. Wouldn't this be a little more straightforward?

    Code:
    Ext.apply(Ext.Ajax.extraParams, {
        param_1: Ext.get('my_id').getValue(),
        param_2: Ext.get('my_id_2').getValue(),
        param_3: Ext.get('my_id_3').getValue()
    });
    I also wonder whether you'd be better off using a cookie instead.

  8. #7
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    7
    Answers
    1
    Vote Rating
    0
    remeis is on a distinguished road

      0  

    Default


    Quote Originally Posted by skirtle View Post
    I think the most widely used technique for applying overrides in ExtJS 4 is:

    Code:
    Ext.require('classname', function() {
        // Callback for when the class has been loaded. Apply the overrides here.
    });
    Thanks skirtle! This code looks much more elegant and also works for me using ext.js.

Thread Participants: 2