1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    92
    Vote Rating
    0
    Perdiga is an unknown quantity at this point

      0  

    Default Problem with disclosure and delete button

    Problem with disclosure and delete button


    why disclosure and delete button does not work? in pr3 works fine

    Code:
    Ext.define('App.view.TocListItem', {
    	extend: 'Ext.dataview.component.DataItem',
    	xtype : 'toclistitem',
    
    
    	config: {	
            cls: 'x-list-item',	               
            layout: {
    			type: 'hbox',
    			align: 'middle'
    		},                       
    
    
            propertiesButton: {                                       			
                cls:'x-list-disclosure',                                     
                margin: '0 -12',                                                                                                                           
    		},
    
    
            deleteButton: {                                       
    			text: 'Apagar',			
                ui: 'decline-small',
    			hidden: false,
                margin: '0 11 0 -68 ', 
                height: 32,
                width: 72,
    		},        
            
    		items: [                        
    			{	                                           
    				tpl: [  
                        '<div class="toclist-item">',
                            '<img src="{icone}" class="toclist-item-img" alt="" />', 
                            '<tpl if="nome == ' + "'...'" + '">', 
                                '<div class="toclist-item-title-back">{nome}</div>',  
                                '<div class="toclist-item-description"></div>',                             
                            '</tpl>',    
                            '<tpl if="nome != ' + "'...'" + '">', 
                                '<div class="toclist-item-title">{nome}</div>',
                                '<div class="toclist-item-description">{data_modificacao}</div>',	
                            '</tpl>',                                              
                        '</div>',
                    ],
    				flex: 1,
    			},                       
    		],	                
    	},	    
           
        /**
    	 * Retorna uma instância de Ext.Button baseado na configuração do {@link #deleteButton}.
    	 */
    	applyDeleteButton: function(config) {                
            return Ext.factory(config, Ext.Button, this.getDeleteButton());
        },
    
    
        /**
         * Quando a configuração  do {@link #deleteButton} é atualizada, aplica ao item.
         */
        updateDeleteButton: function(newDeleteButton) {
            if (newDeleteButton) {
                this.add(newDeleteButton);
            }
        },
    
    
        /**
    	 * Retorna uma instância de Ext.Button baseado na configuração do {@link #propertiesButton}.
    	 */
    	applyPropertiesButton: function(config) {
            // não exibe quando o item for uma pasta "subir nível"
            if (this.getRecord().data.nome != '...') {
                return Ext.factory(config, Ext.Button, this.getPropertiesButton());                        
            }
        },
    
    
        /**
         * Quando a configuração  do {@link #propertiesButton} é atualizada, aplica ao item.
         */
        updatePropertiesButton: function(newPropertiesButton) {    
            if (newPropertiesButton) {
                this.add(newPropertiesButton);
            }
        },
    });

  2. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Ext.Button is not a container so it will not accept an items configuration like you specified in the delete button.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

Thread Participants: 1