1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    40
    Vote Rating
    0
    Answers
    1
    kramal is an unknown quantity at this point

      0  

    Default Unanswered: Why Ext.grid.Panel does not show data?

    Unanswered: Why Ext.grid.Panel does not show data?


    Hello people!

    I have a little apps with code here:
    But i fail to see what matter is.
    Why my grid does not show data?

    Thanks!


    Ext.onReady(function(){


    Ext.define('Mojo',{
    singleton:true,
    get:{
    favorities:[
    {text:'button1', url:'/testurl1/test.html', target: 'new'},
    {text:'button2', url:'/testurl2/test.html', target: 'self'},
    {text:'button3', url:'/testurl3/test.html', target: 'new'},
    {text:'button4', url:'/testurl4/test.html', target: 'self'},
    ]
    }
    });


    Ext.define('Task',{
    extend:'Ext.panel.Panel',
    title:'Task 1',
    defaults:{
    layout:'fit'
    },
    width:400,
    initComponent:function(){
    var me=this;


    me.grid=Ext.create('Ext.grid.Panel',{
    store:Mojo.get['favorities'],
    columns:[
    {text:'Button', dataIndex:'text',flex:1},
    {text:'Text', dataIndex:'url',flex:1},
    {text:'Action',flex:1}
    ],

    });
    me.grid.add([{text:'Hw',url:'sss'}]);
    me.items=[me.grid];
    me.renderTo=Ext.getBody();


    me.callParent(arguments);
    }
    });


    Ext.create('Task');


    alert(Mojo.get.favorities.length)

    });

  2. #2
    Sencha Premium Member EPV's Avatar
    Join Date
    Dec 2010
    Location
    Sweden
    Posts
    197
    Vote Rating
    15
    Answers
    23
    EPV will become famous soon enough

      0  

    Default


    Hi! You should use model and store:
    http://jsfiddle.net/EmilPennlov/VtxxA/1/

    Some other comments:
    - You don't need to put your grid in a panel, it's overnesting.
    - You don't add data to the grid, you add to the store (like a database that the grid uses)
    - Please use code blocks in post so that the code is more readable.

    Good luck!

Thread Participants: 1