1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    10
    Vote Rating
    0
    Valik71 is on a distinguished road

      0  

    Default Answered: Choosing only one value

    Answered: Choosing only one value


    I have a tree with a list of folders is displayed in a popup window. It is necessary to be able to choose only one value. None of this helps
    PHP Code:
    var selectFolder=function(taskid){    
            var 
    form Ext.create('Ext.form.Panel', {
                
    layout'absolute',       
                
    borderfalse,                    
                
    bodyPadding5,                
                
    items: [            
                    {                
                    
    xtype:'fieldset',
                    
    title'Папки',                
                    
    width:500,                
                    
    defaultType'displayfield',
                    
    layout'anchor',
                    
    defaults: {
                        
    anchor'100%'
                    
    },                
                    
    items :[
                        {
                            
    xtype'treepanel',
                            
    rootVisiblefalse,
                            
    useArrowstrue,                        
                            
    id'folder',
                            
    borderfalse,
                            
    expandtrue,                       
                            
    simpleSelect true,
                            
    //multiSelect: true,                        
                            
    hideCollapseTooltrue,                         
                            
    height400,
                            
    storeExt.create('Ext.data.TreeStore', {
                                
    fields: [
                                    {
    name'text'type'string'},
                                    {
    name'id'type'string'},
                                    {
    name'pid',type:'string'},
                                    {
    name'parent',type:'int'},    
                                    {
    name'pindex',type:'int'}                                                        
                                ],
                                
    proxy: {
                                    
    type'ajax',
                                    
    url'tm_task_tree.php?e=getFolders'
                                
    },
                                
    root: {                                
                                    
    expandedtrue,
                                    
    icon'tpl/def/img/user-home.png',
                                    
    id0
                                
    },                            
                                
    sorters: [{
                                    
    property'type',
                                    
    direction'ASC'
                                
    },{
                                    
    property'pindex',
                                    
    direction'ASC'
                                
    }],
                            })
                        }
                    ]
                }
                ],
                
    buttons: [{            
                    
    width 105height30,
                    
    text'Сохранить',                
                    
    tooltip'Сохраним в выбранной папке',
                    
    handler: function() {
                        var 
    item Ext.getCmp('folder').getView().getChecked(); 
                        
    console.log(item[0].internalId),        
                        
    Ext.Ajax.request({
                            
    url'inc/ajax/tm_task.php?e=setFolderTask',method'POST',
                            
    params: {                            
                                
    idtaskid,                         
                            },
                            
    success: function (resultrequest) {                                                   
                                
    Ext.getCmp('getSelect').close();        
                            }
                        });                            
                    }
                },            
                {                        
                    
    xtype:   'button',            
                    
    width 110height30,
                    
    text'Отмена',                
                    
    tooltip'Ничего не меняем',
                    
    handler: function() {        
                        
    Ext.getCmp('getSelect').close();                
                    }            
                }],
                
            }); 
    As can select only one value.

  2. By default, its only possible to select one node in a tree panel and multiSelect is disabled unless you turn it on. See the example in the documentation:

    http://docs.sencha.com/extjs/4.2.0/#...Ext.tree.Panel

    Click on "Live Preview" and try it.

  3. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,099
    Answers
    113
    Vote Rating
    96
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    By default, its only possible to select one node in a tree panel and multiSelect is disabled unless you turn it on. See the example in the documentation:

    http://docs.sencha.com/extjs/4.2.0/#...Ext.tree.Panel

    Click on "Live Preview" and try it.

  4. #3
    Sencha User
    Join Date
    Apr 2013
    Posts
    10
    Vote Rating
    0
    Valik71 is on a distinguished road

      0  

    Default


    You think I have not seen it? None of this I could not apply.
    How can I do to select only one value?
    Just experience with ExtJS small.

  5. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,099
    Answers
    113
    Vote Rating
    96
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    Please try to remove any code which is not necessary and create a simplified example and put it on jsfiddle.net. Why have you put the treepanel inside a fieldset? add it directly to your form.

    I am not really sure that I understand the problem you are having.

Thread Participants: 1

Tags for this Thread