Results 1 to 4 of 4

Thread: Cannot get GridPanel to show emptyText

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    85

    Default Cannot get GridPanel to show emptyText

    I have the following grid panel
    Code:
    Ext.onReady(function () {
        Ext.QuickTips.init();
    
        var outGrid = new TROutstandingGrid();
        outGrid.render('outstandingRequestsGrid');
    });
    
    TROutstandingGrid = Ext.extend(Ext.grid.GridPanel, {
        store: new Ext.data.JsonStore({
            proxy: new Ext.data.HttpProxy({
                url: baseUrl + '/TestRequests/GetOutstandingRequests',
                method: 'POST'
            }),
            autoLoad: true,
            root: 'data',
            fields: ['id', 'name', 'createdby', 'scheduledtime']
        }),
    
        columns: [{
            id: 'id',
            header: 'Id',
            dataIndex: 'id'
        }, {
            id: 'name',
            dataIndex: 'name',
            header: 'Name'
        }, {
            id: 'createdby',
            dataIndex: 'createdby',
            header: 'Created By'
        }, {
            id: 'scheduledtime',
            dataIndex: 'scheduledtime',
            header: 'Scheduled Time'
        }],
    
        viewConfig: { 
            forceFit: true,
            emptyText: 'No Outstanding Automation Requests'
        },
    
        // Display parameters
        title: 'Outstanding Automated Test Requests',
        collapsible: true
    });
    When the JsonStore is run, the following json is being returned:
    Code:
    {"success":true,"data":[]}
    Even though there is no data being returned, the empty text message will not show. It did show up once, but since the gridPanel was small I added a height to the grid, and I have yet to be able to get it to show up again. No javascript exceptions are being reported by Chrome.

    Does anyone have any idea what I am doing wrong?

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Your grid needs a height (or autoHeight:true).

    ps. You should not put object (like store, columns and viewConfig) in the prototype. Create them in the constructor or initComponent.

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    85

    Default

    Quote Originally Posted by Condor View Post
    Your grid needs a height (or autoHeight:true).
    Adding a height or autoHeight did not make the emptyText appear, but I can see that the height parameters are being taken.

    *edit*: it seems to be somewhat random. I saw the EmptyText message appear a few times, but upon refreshing it now doesn't show.

    ps. You should not put object (like store, columns and viewConfig) in the prototype. Create them in the constructor or initComponent.
    Any reason why? This is exactly how it's done in a lot of the examples on Sencha's own demo page.

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Posts
    85

    Default

    I turned autoloading off and put grid.store.load() in my Ext.onReady(), and my emptyText shows consistently now.

Similar Threads

  1. [SOLVED] emptyText doesn't show up in grid when using autoLoad and data
    By PranKe01 in forum Ext 3.x: Help & Discussion
    Replies: 11
    Last Post: 15 Feb 2010, 12:48 AM
  2. How to force GridPanel emptyText to remain visible?
    By dbassett74 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 14 Jul 2009, 7:23 AM
  3. GridPanel Scrollbar Sometimes Does not Show
    By anortje in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 24 Jun 2008, 6:07 AM
  4. gridpanel show
    By genius551v in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 12 May 2007, 5:50 PM
  5. how to show/hide gridpanel?
    By humpdi in forum Ext 1.x: Help & Discussion
    Replies: 9
    Last Post: 16 Apr 2007, 11:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •