1. #1
    Ext User
    Join Date
    May 2010
    Posts
    9
    Vote Rating
    0
    wysman is on a distinguished road

      0  

    Default [SOLVED]Multiple instance and Id

    [SOLVED]Multiple instance and Id


    Hi,

    I have design a window with Ext designer, It's work fine ! I have set Id for all interesting component.
    So the window.ui.js file is Ok, and in window.js i can find easily my component with a findById on this.

    Now, i have an other window to design; but this window should be open multiple time, so i can't use Id. I try bad idea !
    So i use itemId instead of Id, and i can allocate 2 windows in the same time !
    But to access to my component in the window2.js (not .ui.js), i use 'getComponent' and i not easy because i need to explore layout before, and i have js line like that :

    Code:
    var formHandle = this.getComponent(1).getComponent(0).getComponent(0).getComponent(0);
    formHandle.getComponent('cb-shift').setValue("Foo");
    The first line is horrible, and if i adjust layout of my window, i may broke this code. getComponent is not recursive ...

    How to do that, more proper ?

    Regards
    Last edited by wysman; 9 Jun 2010 at 4:20 AM. Reason: solved

  2. #2
    Sencha User
    Join Date
    Jun 2010
    Location
    Buenos Aires, Argentina
    Posts
    213
    Vote Rating
    9
    ldonofrio will become famous soon enough

      0  

    Default


    I think you have to use "refs", see property in designer.

  3. #3
    Ext User
    Join Date
    May 2010
    Posts
    9
    Vote Rating
    0
    wysman is on a distinguished road

      0  

    Default


    Quote Originally Posted by ldonofrio View Post
    I think you have to use "refs", see property in designer.
    Do you mean 'autoRef' ?
    Have you a small exemple ?

    Thanks

  4. #4
    Sencha User
    Join Date
    Jun 2010
    Location
    Buenos Aires, Argentina
    Posts
    213
    Vote Rating
    9
    ldonofrio will become famous soon enough

      0  

    Default


    Yes, set autoRef in "cb-shift" component in Designer to for ex. "CbShift" ,and then code "this.CbShift.setValue('foo')" in initComponent method of your root designer component.

  5. #5
    Ext User
    Join Date
    May 2010
    Posts
    9
    Vote Rating
    0
    wysman is on a distinguished road

      0  

    Default


    Quote Originally Posted by ldonofrio View Post
    Yes, set autoRef in "cb-shift" component in Designer to for ex. "CbShift" ,and then code "this.CbShift.setValue('foo')" in initComponent method of your root designer component.
    Not working, on my project.
    Does somethings to turn 'on' before, configuration option of EXTJS ?

    Thx

  6. #6
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD.
    Posts
    1,745
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    wysman, ldonofrio is correct. When you set the "autoRef" property in the Designer, a "ref" configuration is automatically generated for the component that will place its reference at the top-level (root) parent component. If you try his suggestion again, just make sure you are referencing "this.CbShift" AFTER the call to the superclass' initComponent method:

    Code:
    MyWindow = Ext.extend(MyWindowUi, {
        initComponent: function(){
            MyWindow.superclass.initComponent.call(this);
    
            this.CbShift.setValue("foo");
        }
    });
    Now I don't know what type of component "CbShift" is, but setValue might not have an effect in the initComponent stage...you may need to attach to CbShift's "render" event and after it is rendered, then set its value.

    Hope that helps!

  7. #7
    Ext User
    Join Date
    May 2010
    Posts
    9
    Vote Rating
    0
    wysman is on a distinguished road

      0  

    Default [SOLVED]Multiple instance and Id

    [SOLVED]Multiple instance and Id


    Thanks ldonofrio & jarrednicholls

    I just fix the problem.
    Instead of export xds project, i have just edit the .ui.js to test, and i forgot to set some '../../../../' before my ref name.
    Ref are relative path !

    I work fine now !

  8. #8
    Sencha - Desktop Packager Dev Team jarrednicholls's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD.
    Posts
    1,745
    Vote Rating
    7
    jarrednicholls will become famous soon enough jarrednicholls will become famous soon enough

      0  

    Default


    The autoRef automatically generates the relative path needed to place the reference at the top-most parent/root component. So when you supply an autoRef of "CbShift", a ref is created that will look like "../../../../CbShift". I'm glad you got it working, but keep in mind that the .ui.js file is overwritten on each project export (the .js file is not).

Similar Threads

  1. DatePicker,can we get the instance of the Button in it?
    By Love Yao in forum Ext GWT: Discussion
    Replies: 2
    Last Post: 21 Jan 2010, 10:01 PM
  2. Only one Fx instance at a time?
    By JensHeyer in forum Community Discussion
    Replies: 3
    Last Post: 26 May 2009, 3:13 AM
  3. Making Sure A Tab Has One Instance
    By RyanZec in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 27 May 2008, 4:14 AM
  4. multi instance window
    By pedro226 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 29 Feb 2008, 7:27 PM
  5. How to get BorderLayout Region instance
    By fawzyj in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 15 Oct 2007, 3:57 PM

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar