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.

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    49
    Vote Rating
    0
    chaddjohnson is on a distinguished road

      0  

    Default How to reference ancestor container object from an ExtJS control?

    How to reference ancestor container object from an ExtJS control?


    I am using ExtJS to build a window containing several panels as items. One of these panels contains a button.

    I want to attach a handler to my button such that when I click the button, I can hide the window containing the above-mentioned panels and this button.

    My question is: how can i get a reference to the parent window of my button WITHOUT referencing the window by id? I literally want a reference to the Ext.Window instance and not the Ext.Panel instance that contains my button.

    Note: I do not want to reference the window by id because I am subclassing the Ext.Window class, and therefore the window's id will not always be the same. In short, I am creating a Wizard class, and when I click the wizard's Cancel button, I want to hide the wizard window containing the button.

    Here is my code:
    Code:
        var newWizardWindow = new WizardWindow({
          id: 'newWizardWindow',
          title: 'New',
          items: [
            ...
          ],   
          buttons: [{
            text: 'Cancel',
            handler: function() {
              // REFERENCE WizardWindow instance here.
            }
          },{
            id: 'newWizardPreviousButton',
            text: '« Previous',
            disabled: true,
            handler: newWizardNavigator.createDelegate(this, [-1])
          },{
            id: 'newWizardNextButton',
            text: 'Next »',
            handler: newWizardNavigator.createDelegate(this, [1])
          }],
          listeners: {
            …
          }
        });
    Here are some ideas I have come up with as far as how to hide the window:
    1. this.ownerCt.ownerCt (this being the button). Not favorable as with a future update to ExtJS, the number of parents between the window and the button might change.
    2. Somehow store a reference to the WizardWindow instance in the WizardWindow class.
    3. Find the closest WizardWindow [CSS] class in jQuery fashion: $(this).closest('.wizardWindow'). Maybe this.findByParentType('WizardWindow')?

  2. #2
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    Option 3 is spot on, except it's more generic to do this:

    Code:
    this.findByParentType(Ext.Window)

Similar Threads

  1. Replies: 0
    Last Post: 12 May 2011, 7:25 PM
  2. How to reference container's function?
    By dlw in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 16 Dec 2008, 6:43 PM
  3. a string reference vs. object reference passed to a function
    By dolittle in forum Community Discussion
    Replies: 2
    Last Post: 1 Nov 2008, 8:45 AM
  4. How to get reference to parent container?
    By pic_Nick in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 8 Nov 2007, 1:08 AM

Thread Participants: 1