-
5 Jul 2012 10:11 AM #1
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??? });
-
5 Jul 2012 12:09 PM #2
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.
-
5 Jul 2012 9:15 PM #3
You say that != operator doesn't work and you get the wrong combo(s) ?
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
6 Jul 2012 5:37 AM #4
-
6 Jul 2012 1:02 PM #5
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
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
9 Jul 2012 6:09 AM #6
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(); }
-
9 Jul 2012 12:03 PM #7
Yes ! (not) operator before = is ignored. != is understood as =.
Moving this thread to bugs.Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
9 Jul 2012 2:43 PM #8
This has been reported.
Scott.
-
9 Jul 2012 3:04 PM #9
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?
-
9 Jul 2012 5:44 PM #10
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 ...
Scott.Code:Ext.override(Ext.ComponentQuery, { query: function(selector, root) { // paste our code and make changes as needed. } });
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote
