1. #1
    Sencha User
    Join Date
    Feb 2010
    Posts
    355
    Answers
    15
    Vote Rating
    4
    maneljn is on a distinguished road

      0  

    Default Unanswered: nested list with data hardcoded example ?

    Unanswered: nested list with data hardcoded example ?


    does anyone have an example of how to code a nestedlist with the treestore data hardcoded in any way ?

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    15
    Vote Rating
    0
    abhi.ece is on a distinguished road

      0  

    Default


    In store put
    var store = Ext.create('Ext.data.TreeStore', {
    model:
    'ListItem',defaultRootProperty: 'items',root:data
    });
    where data is hard coded one like


    var
    data = {text: 'M2 Report Home',items: [{text: 'DashBoard',items: [{text: 'Overview',id: 'overview',leaf: true

    }, {text:
    'Leaf1'',id: 'Leaf1'',leaf: true

    }, {text:
    'Leaf2',id: 'Leaf2',leaf: true

    }, {text:
    'Leaf3',id: ''Leaf3'',leaf: true

    }]
    }, {text: ''Leaf'',id: 'Leaf',leaf: true

    }, {text:
    'Leaf',id: ''Leaf1''',leaf: true

    }]};

  3. #3
    Sencha User
    Join Date
    Feb 2010
    Posts
    355
    Answers
    15
    Vote Rating
    4
    maneljn is on a distinguished road

      0  

    Default


    thanks for your response.
    I've trying this but no result...

    Code:
    Ext.define('CesigestMobile.view.MenuPrincipal', {
        extend: 'Ext.NestedList',
        alias : 'widget.CesigestMobile_view_MenuPrincipal',
    
        constructor: function(config) {
    
              config = config || {};
    
              var dataMenu = {
                text: 'Maestros',
                items: [{
                    text: 'Clientes',
                    items: [{
                        text: 'Overview',
                        id: 'overview',
                        leaf: true
                    },{
                        text: 'Leaf1',
                        id: 'Leaf1',
                        leaf: true
                    },{
                        text: 'Leaf2',
                        id: 'Leaf2',
                        leaf: true
                    }]
                }]
              };
    
            var storeMenu = Ext.create('Ext.data.TreeStore', {
                model: 'ListItem',
                defaultRootProperty: 'items',
                root: dataMenu
            });
              
            // Aplicar configuraciones por defecto
            Ext.apply(this, config,
            {
                title: 'Cesigest - Menu',
                cardSwitchAnimation: 'slide',
                displayField: 'text',
                useTitleAsBackText: true,
                store: storeMenu,
                listeners: {
                    leafitemtap: function(list, index, item, e) {
                        var me = list.getParent(),
                            store = list.getStore(),
                            record  = store.getAt(index),
                            detailCard = me.getDetailCard();
        
                        alert("hoja clicada");                
                    }
                }
            });  
    
            this.callParent(arguments);
        },
        
        
        // Inicializar el componente
        initialize: function() {
            this.callParent();
        }
        
    });
    Code:
    function arrancamos() {
    
        Ext.setup({
    
            onReady: function() {
    
                Ext.define('CesigestMobile.App', {
                    extend: 'Ext.app.Application',
        
                    name: 'aplicacion',
                    appFolder: 'app',
                    autoCreateViewport: false,
    
                    // Metodo para lanzar la aplicacion.             
                    launch: function() {
                    
                        // Mostrar Menu principal
                        this.contenedorTitulo = Ext.create('Ext.Panel', {
                            title: 'Cesigest Mobile - Menu'
                        });                    
                        this.menuPrincipal = Ext.create('CesigestMobile.view.MenuPrincipal');
                        this.contenedorPrograma = Ext.create('Ext.Panel', {
                            layout: 'fit',
                            flex: 1,
                            items: [ this.menuPrincipal ]
                        });
                        
                        this.contenedorPrincipal = Ext.create('Ext.Container', {
                            fullscreen: true,
                            layout: 'vbox',
                            items: [ 
                                this.contenedorTitulo,
                                this.contenedorPrograma
                            ]
                        });
                        
                        Ext.Viewport.add( this.contenedorPrincipal ); 
    
                    }
    
                });    
                
                // Lanzar aplicacion principal
                var aplicacion = new CesigestMobile.App();
                
            }
            
        });
        
    };
    The result is something like this screen capture...
    Captura.JPGno

    nothing written inside the nestedlist control.

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    15
    Vote Rating
    0
    abhi.ece is on a distinguished road

      0  

    Default


    can you try exactly how it is there in the nested list example(http://docs.sencha.com/touch/2-0/#!/...ist/index.html) as I see in your code you have used "launch" and "onReady" both. So in the example just change "root : data" in the store as I had suggested.

Thread Participants: 1