1. #1
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default [Closed] ComponentQuery and Viewport

    [Closed] ComponentQuery and Viewport


    Using ComponentQuery on Viewport seems to deliver the correct object, but methods of the object are not accessible.

    This query fails:
    Code:
    Ext.ComponentQuery.query('viewport').getLayout()
    While this works (viewport with id 'viewport':

    Code:
    Ext.getCmp('viewport').getLayout()
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  2. #2
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    should you be doing:

    PHP Code:
      Ext.ComponentQuery.query('#viewport').getLayout(); 
    ? Just a question - I'm just learning this myself. Or are you trying to do this by xtype instead of id/itemId?

    stevil

  3. #3
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    that would query for itemId viewport

    Using viewport searches for the component widget.viewport, which returns the correct object
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  4. #4
    Ext JS Premium Member
    Join Date
    Dec 2010
    Location
    Hamburg, Germany
    Posts
    192
    Vote Rating
    6
    winkelmann is on a distinguished road

      0  

    Default


    From what I've been able to gather about ComponentQuery, the query() method actually returns an array of found elements, even if only a single element is found.

    The following should work for you:
    PHP Code:
    Ext.ComponentQuery.query('viewport')[0].getLayout() 
    That is, of course, unless i missed some neat mapping of access to element 0 of the returned array :-)

  5. #5
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    Indeed - but this is unusual as there is only one vieport possible

    Then the query should look for array length and return first element if there is only one in, or?
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  6. #6
    Ext JS Premium Member
    Join Date
    Dec 2010
    Location
    Hamburg, Germany
    Posts
    192
    Vote Rating
    6
    winkelmann is on a distinguished road

      0  

    Default


    I don't think returning the element directly if only one was found would be such a good idea. Imagine you're searching for a specific element xtype like so:

    PHP Code:
    Ext.ComponentQuery.query('panel'); 
    and it only finds one, then you would get it directly, but if it finds two, you get an array. Now that would make bulk processing very difficult with Componentquery:

    PHP Code:
    var panels Ext.ComponentQuery.query('panel');
    if ( 
    Ext.isArray(panels) ) {
    for ( var 
    i=0i<panels.lengthi++ ) panels[i].setTitle('foo');
    } else 
    panels.setTitle('foo'); 
    I think I prefer having it return an array always :-)

  7. #7
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    you're right, i close this one.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

Similar Threads

  1. Ext.ComponentQuery.query() not working
    By ashish01 in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 7 Sep 2012, 4:45 AM
  2. [OPEN-EXTJSIV-1804]Ext.ComponentQuery xtype
    By rchloupe in forum Ext:Bugs
    Replies: 0
    Last Post: 30 Apr 2011, 12:00 PM
  3. Replies: 6
    Last Post: 27 Feb 2011, 3:26 AM
  4. ComponentQuery: search tools array
    By htammen in forum Ext: Discussion
    Replies: 2
    Last Post: 26 Feb 2011, 2:04 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