GridPanel in Extjs is not loaded

Posted by pho3nix on Stack Overflow See other posts from Stack Overflow or by pho3nix
Published on 2010-05-17T22:46:11Z Indexed on 2010/05/17 22:50 UTC
Read the original article Hit count: 468

Filed under:
|

I have this code in my application, but this not load any data. Data is accessible but wont display in my gridpanel, anyone have idea, why?

 Ext.onReady(function () {
        Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget = 'side';

        var btnAdd = new Ext.Button({
            id: 'btnAdd',
            text: 'Adicionar',
            iconCls: 'application_add',
            handler: function (s) {

            }
        });
        var btnEdit = new Ext.Button({
            id: 'btnEdit',
            text: 'Editar',
            iconCls: 'application_edit',
            handler: function (s) {

            }
        });
        var btnRemove = new Ext.Button({
            id: 'btnRemove',
            text: 'Apagar',
            iconCls: 'application_delete',
            handler: function (s) {

            }
        });

        var tbar = new Ext.Toolbar({
            items: [btnAdd, btnEdit, btnRemove]
        });

        var formFind = new Ext.FormPanel({            
            height: 100
        });

        var store = new Ext.data.JsonStore({
            remoteSort: true,
            idProperty: 'ContentId',
            root: 'rows',
            totalProperty: 'results',
            fields: [
                { name: 'ContentId', type: 'int' },
                { name: 'Name' },
                { name: 'Version' },
                { name: 'State' },
                { name: 'CreatedDateTime' },
                { name: 'PublishedDateTime'},
                { name: 'CreatedByUser' },
                { name: 'PublishedByUser' }
            ],
            proxy: new Ext.data.ScriptTagProxy({
                url: '/Admin/ArticleList'
            })
        });
        store.setDefaultSort('ContentId', 'desc');

        var paging = new Ext.PagingToolbar({
            store: store,
            pageSize: 25,
            displayInfo: true,
            displayMsg: 'Foram encontrados {2} registos. Mostrando {0} de {1}',
            emptyMsg: "Nenhum registo encontrado."
        });

        var grid = new Ext.grid.GridPanel({
            id: 'grid',
            height: 700,
            store: store,
            loadMask: true,
            loadingText: 'Carregando...',
            autoHeight: true,
            cm: new Ext.grid.ColumnModel ([
                { id: 'ContentId', dataIndex: 'ContentId', header: 'Identif.', width: 60, sortable: true },
                { id: 'Name', dataIndex: 'Name', header: 'Titulo', width: 75, sortable: true },
                { id: 'Version', dataIndex: 'Version', header: 'Versão', width: 75, sortable: true },
                { id: 'State', dataIndex: 'State', header: 'Estado', width: 75, sortable: true },
                { id: 'CreatedDateTime', dataIndex: 'CreatedDateTime', header: 'Data de Criação', width: 85, sortable: true },
                { id: 'PublishedDateTime', dataIndex: 'PublishedDateTime', header: 'Data de Publicação', width: 75, sortable: true },
                { id: 'CreatedByUser', dataIndex: 'CreatedByUser', header: 'Criado por', width: 75, sortable: true },
                { id: 'PublishedByUser', dataIndex: 'PublishedByUser', header: 'Publicado por', width: 85, sortable: true }
            ]),
            stripeRows: true,
            viewConfig: { forceFit: true },
            bbar: paging
        });

        var panel = new Ext.Panel({
            id: 'panel',
            renderTo: Ext.getBody(),
            layout: 'fit',
            tbar: tbar,
            items: [grid]
        });

        store.load(); // trigger the data store load
    });

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about extjs