1. #21
    Sencha User galdaka's Avatar
    Join Date
    Mar 2007
    Location
    Spain
    Posts
    1,166
    Vote Rating
    -1
    galdaka is an unknown quantity at this point

      0  

    Default


    Quote Originally Posted by WebArchitect View Post
    It's just a small modification on the initial code posted here... It's not so difficult to figure it out.
    Where is the code that is posted here? I dont view initial code, only two photos in first post!!

    Greetings,

  2. #22
    Ext User
    Join Date
    Sep 2008
    Posts
    1
    Vote Rating
    0
    maarten is on a distinguished road

      0  

    Default


    Quote Originally Posted by WebArchitect View Post
    Just a quick hack on this one...

    tree1.on('click',function(node){
    comboxWithTree.valueNotFoundText = node.text;
    comboxWithTree.setValue(node.id);
    comboxWithTree.collapse();
    });

    So now we can see the selected text and the selected id is submitted to the server.
    Took me a while to get this working in ext 2.2. Apparently the valueNotFoundText is set only if the valueField is set as well.

    The first example will then become:

    HTML Code:
           var comboxWithTree = new Ext.form.ComboBox({
    		store:new Ext.data.SimpleStore({fields:[],data:[[]]}),
    		editable:false,
    		shadow:false,
    		mode: 'local',
    		triggerAction:'all',
    		maxHeight: 200,
    		tpl: '<tpl for="."><div style="height:200px"><div id="tree1"></div></div></tpl>',
    		selectedClass:'',
    		onSelect:Ext.emptyFn,
    		valueField: 'id'
    	});
    	var tree1 = new Ext.tree.TreePanel({
    		loader: new Tree.TreeLoader({dataUrl:'get-nodes.php'}),
    		border:false,
     		root:new Ext.tree.AsyncTreeNode({text: 'treeRoot',id:'0'})
      	});
      	tree1.on('click',function(node){
      		comboxWithTree.valueNotFoundText = node.text;
      		comboxWithTree.setValue(node.id);
      		comboxWithTree.collapse();
      	});
    	comboxWithTree.on('expand',function(){
    		tree1.render('tree1');
      	});
    	comboxWithTree.render('comboxWithTree');

  3. #23
    Sencha User galdaka's Avatar
    Join Date
    Mar 2007
    Location
    Spain
    Posts
    1,166
    Vote Rating
    -1
    galdaka is an unknown quantity at this point

      0  

    Default


    There is no code in first post. Only two images.

    Thanks in advance,

  4. #24
    Ext User skaue's Avatar
    Join Date
    Sep 2008
    Location
    Troms
    Posts
    191
    Vote Rating
    0
    skaue is on a distinguished road

      0  

    Default


    Quote Originally Posted by galdaka View Post
    There is no code in first post. Only two images.

    Thanks in advance,
    @galdaka:

    Seems to me that this isn't an extension or plugin, just an idea of using the builtin mechanisms in ExtJs. The code is simply the code written in the first post (and not the attached zips containing the images). Get it?
    Webdeveloper from Norway

  5. #25
    Ext User
    Join Date
    Sep 2007
    Posts
    102
    Vote Rating
    0
    timo.nuros is on a distinguished road

      0  

    Default


    I wrapped the whole thing together into a custom class:


    PHP Code:
    Ext.ns("Netwatch24");

    Netwatch24.TreeComboBox Ext.extend(Ext.form.ComboBox, {
        
    treenull,
        
    treeId0,
        
    initComponent: function(){
            
    this.treeId Ext.id();
            
    this.focusLinkId Ext.id();
            
            
    Ext.apply(this, {
                
    store:new Ext.data.SimpleStore({fields:[],data:[[]]}),
                
    editable:false,
                
    shadow:false,
                
    mode'local',
                
    triggerAction:'all',
                
    maxHeight200,
                
    tpl'<tpl for="."><div style="height:200px"><div id="'+this.treeId+'"></div><a href="#" class="x-grid3-focus" id="'+this.focusLinkId+'" tabIndex="-1"/></div></tpl>',
                
    selectedClass:'',
                
    onSelect:Ext.emptyFn,
                
    valueField'id'
            
    });
            
            var 
    treeConfig = {
                
    border:false
            
    };
                    
            
    Ext.apply(treeConfigthis.treeConfig);
            
            if (!
    treeConfig.root) {
                
    treeConfig.root = new Ext.tree.AsyncTreeNode({text'treeRoot',id:'0'}); 
            }
            
            
    this.tree = new Ext.tree.TreePanel(treeConfig);
            
            
    this.on('expand'this.onExpand);
            
    this.tree.on('click'this.onClickthis);
            
            
    Netwatch24.TreeComboBox.superclass.initComponent.call(this);
            
        },
        
    onTriggerClick : function(){
            if(
    this.disabled){
                return;
            }
            if(
    this.isExpanded()){
                
    this.collapse();
            }else {
                
    this.onFocus({});
                if(
    this.triggerAction == 'all') {
                    
    this.doQuery(this.allQuerytrue);
                } else {
                    
    this.doQuery(this.getRawValue());
                }
            }
        },
        
    onFocus : function () {
            
    Netwatch24.TreeComboBox.superclass.onFocus.call(this);
            
    Ext.get(this.focusLinkId).focus();
        },
        
    onClick: function (node) {
              
    this.valueNotFoundText node.text;
              
    this.setValue(node.id);
              
    this.collapse();
          },
        
    onExpand: function(){
            
    this.tree.render(this.treeId);
            
    this.tree.focus();
        }
    });

    Ext.reg("netwatch24.treecombobox"Netwatch24.TreeComboBox); 

    Feel free to adjust the namespace to your needs. Maybe someone likes to add some minor detail work (documentation, more generic implementation).

    Regards,
    Timo

  6. #26
    Ext User
    Join Date
    Jan 2009
    Posts
    14
    Vote Rating
    0
    festr is on a distinguished road

      0  

    Default


    This extension is not supposed to load state of the tree like classic combo when loading data to a form? I'll need this and thinikg about ways how to achieve that. Anyone solved this?

  7. #27
    Sencha User
    Join Date
    Aug 2010
    Posts
    67
    Vote Rating
    0
    shahdollie is on a distinguished road

      0  

    Default suspend/cancel onTriggerClick event of combobox for combobox tree

    suspend/cancel onTriggerClick event of combobox for combobox tree


    hi everyone

    Thanks for this wonderful idea..........it really helped alot....

    But I have a small problem ...... when + or arrow on tree is clicked, the combobox collapses

    I think it is because of onTriggerClick event of combobox...so is there any way to stop this????????

    I just want to suspend/cancel onTriggerClick event of combobox when i expand it and resume/allow when i collapse it....

    For reference follow is the code for onTriggerClick event of combobox

    <div id="method-Ext.form.ComboBox-onTriggerClick"></div>
    /**
    * @method onTriggerClick
    * @hide
    */
    // private
    // Implements the default empty TriggerField.onTriggerClick function
    onTriggerClick : function(){
    if(this.readOnly || this.disabled){
    return;
    }
    if(this.isExpanded()){
    this.collapse(); //THIS MAKES COMBOBOX TO COLLAPSE
    this.el.focus();
    }else {
    this.onFocus({});
    if(this.triggerAction == 'all') {
    this.doQuery(this.allQuery, true);
    } else {
    this.doQuery(this.getRawValue());
    }
    this.el.focus();
    }
    }

    Please help me....Thanks

    Regards

  8. #28
    Ext JS Premium Member
    Join Date
    Feb 2008
    Location
    Feuerthalen, Switzerland
    Posts
    30
    Vote Rating
    0
    codeworx is on a distinguished road

      0  

    Default


    see thread http://www.sencha.com/forum/showthre...d=1#post527651 for a possible but dirty solution

  9. #29
    Sencha User
    Join Date
    Nov 2011
    Posts
    1
    Vote Rating
    0
    sencha123456 is on a distinguished road

      0  

    Default


    Thank you for sharing information, I'm so need this information!

  10. #30
    Sencha User harman's Avatar
    Join Date
    Jul 2011
    Location
    India
    Posts
    132
    Vote Rating
    3
    harman is on a distinguished road

      0  

    Default ComboBox Tree

    ComboBox Tree


    Hi,

    Really a useful work for all in need.
    But can anyone suggest an Equvivalent in ExtJS 4?
    I need a combo that on expanding shows a Tree structure.

    I would really appreciate the help.

    Thanks in advance.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi