Reputation: 1493
The empty text in Ext 4.2 seems to not be displaying for Ext.grid.Panel
I can demonstrate by using the javascript editor here: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.Panel
Just delete the data
config for the store, and then add the emptyText
config for the panel on the first example. It should look like this:
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
//No data here
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
emptyText: 'Test Empty Text', //Add emptyText
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
Note that the text will show up, once you click on Name
, Email
, or Phone
- once the grid gets sorted.
Is this an Ext bug? How can I work around this to get emptyText to show up without having to sort the panel first?
Upvotes: 1
Views: 2195
Reputation: 3734
No it's a feature. The point is to not show the empty text while the grid is loading data because it is not yet known whether there is data or not.
The feature is not needed when the data is all local though, so just add the following to the grid config:
viewConfig: {
deferEmptyText: false
}
Upvotes: 3