Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    78
    Vote Rating
    1
    kmanuel@entausa.com is on a distinguished road

      0  

    Question Switch between elements on combobox change

    Switch between elements on combobox change


    I have a combobox with static values (0,1,2). For '2', I want to switch between 2 sets of components to display. The first set I have the DateTime field from here. The second is just a textfield. I want to do this in a generic method that doesn't reference the objects by an ID or assume there's (n) components available. For structure, do I include all components, just hidden:true then show()/hide() on my change listener? Also, when I try to query name!= I get what I was NOT looking for. See below.


    Code:
        cbo.addListener('change', function () {
            var fs = this.up('fieldset'); //works
            var dates = fs.query('datefield'); //works
            var cbos = fs.query('combo[name!='+cbo.name+']'); //Gives me my original combo???
        });

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,080
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You may have to override add this operation, as I do not believe this operation is support.

    The other option is to assign an itemId to each and then exclude that one from the list when querying for others.

    Scott.

  3. #3
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    You say that != operator doesn't work and you get the wrong combo(s) ?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  4. #4
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    78
    Vote Rating
    1
    kmanuel@entausa.com is on a distinguished road

      0  

    Default


    Quote Originally Posted by jsakalos View Post
    You say that != operator doesn't work and you get the wrong combo(s) ?
    Yes. These two return exactly the same thing:

    Code:
    console.log(fs.query('combo[name=TransDateOption]')[0] == fs.query('combo[name!=TransDateOption]')[0]);
    true

  5. #5
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    If wrapping the name "TransDateOption" in double quotes doesn't help then it is a bug. Prepare please a simple showcase, I can move this thread to bugs then.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  6. #6
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    78
    Vote Rating
    1
    kmanuel@entausa.com is on a distinguished road

      0  

    Default


    I used the Ext4.1 example contact form. In the window buttons, I changed the 'cancel' button handler to the below. All 6 queries returned 1 for length and the field name was 'firstName'.

    Code:
    handler: function() {
            var form = this.up('form');
            var arr = [
                form.query('textfield[name=firstName]')
                ,form.query('textfield[name!=firstName]')
                ,form.query('textfield[name="firstName"]')
                ,form.query('textfield[name!="firstName"]')
                ,form.query("textfield[name='firstName']")
                ,form.query("textfield[name!='firstName']")
            ];
            
            Ext.each(arr,function(a) {
                if (a.length > 0)
                    console.log(a.length,a[0].name);
            });
            
            this.up('form').getForm().reset();
            this.up('window').hide();
    }

  7. #7
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,538
    Vote Rating
    380
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Yes ! (not) operator before = is ignored. != is understood as =.

    Moving this thread to bugs.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  8. #8
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,080
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    This has been reported.

    Scott.

  9. #9
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    78
    Vote Rating
    1
    kmanuel@entausa.com is on a distinguished road

      0  

    Default


    Thanks. Any ETA? I was relying on this being available for multiple areas. Workaround would be to not use name in my query, then do an Ext.each() on the array, checking for name?

  10. #10
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,080
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I have no ETA on this bug since it was just filed to day. I would suggest you override the provided function to allow for your operator to function.

    example ...
    Code:
    Ext.override(Ext.ComponentQuery, {
    
       query: function(selector, root) {
          // paste our code and make changes as needed.
       }
    
    });
    Scott.