2
votes
  • Updated Question

I believe, we have the grid panel's emptyText defined to 'No Records to display' by default. Am i right? If so, Is there a getter and setter method pair that I can use to check the value and set it to a customized message?

An example of when I want to use a getter method:

  • Customized gridpanel class with more user defined functions

       Ext.define('Everest.ux.grid.Panel', {
          extend: 'Ext.grid.Panel',
          alias: 'widget.extGridPanel',
    
          appId: '',
    
          more customized methods
          ....
    
  • My Grid Component Class extending the above defined

    Ext.define('Everest.ux.grid.MyGrid', {
    
        extend: 'Everest.ux.grid.Panel',
        alias: 'widget.myGrid',
    
        screenId: '',
        moduleId: '',
    
        initComponent : function() {
           var me = this;
           me.firstTimeLoaded = false;
           me.callParent();
        },
        ....
    
    
            var customStore = new Ext.data.Store({                          
                fields: customStoreFields,
                groupField: groupByDefaultField,
                sorters: customSorters,
                sortOnLoad: !Ext.isEmpty(customSorters),
                proxy: {
                    type: Ext.isEmpty(me.proxyType) ? 'ajax' : me.proxyType,
                    url: customDefinedURL,
                    reader: {
                        type: 'json'
                    }
                }
            });
    
            **me.reconfigure(customStore, newCustomFields);**
    

me refers to my grid component. I have not defined emptyText attribute in any of my customized components but im still seeing that 'No Records to display' message while the grid is fetching data. I am thinking me.reconfigure is the place where im seeing the message even while the grid is fetching data.

2
That shouldn't be the case. May be you are loading an empty store or something first? Show us more code - hop
@hop - Thanks for your reply. That helped me narrow down to my problem. I updated my question. Please let me know if i need to provide any details. Thanks - schinta2

2 Answers

1
votes

Note that when using local data the emptyText will not be displayed unless you set the deferEmptyText option to false.

Why can't you try with autoload:true in store (Let it be false, if require).

Please refer below link for emptyText definition.

http://docs.sencha.com/extjs/4.0.7/#!/api/Ext.view.AbstractView-cfg-emptyText

Thanks.

0
votes

That shouldn't be the case. May be you are loading an empty store or something first?

Yeah, I see we are loading an empty store initially and that explained certain things. I believe, we have the grid's emptyText defined to 'No Records to display' by default. Am i right?

No, you are wrong. You are setting the emptyText by this block in your code

viewConfig:{

        emptyText: 'No data to display',
        deferEmptyText: true

}

Also, what is worrying me is "deferEmptyText" defaults to true. Be more clear in what is the issue you are facing and what you exactly need.

Refer http://docs.sencha.com/extjs/4.0.7/#!/api/Ext.view.AbstractView-cfg-deferEmptyText