To make this work, you have to add cls to your grid, for example cls : 'customgrid' . After that, create the following CSS rule:
.customgrid .x-grid-empty { position: absolute; top: 50%; width: 100%; text-align: center; }
And you should see that your empty text is centered.
Here is a sample code and fiddle:
Ext.create('Ext.data.Store', { storeId:'simpsonsStore', fields:['name'], data: [], proxy: { type: 'memory', reader: 'array' } }); Ext.create('Ext.grid.Panel', { margin: 10, store: 'simpsonsStore', cls: 'customgrid', border: true, columns: [ {header: 'Name', dataIndex: 'name', flex: true} ], viewConfig: { deferEmptyText: false, emptyText: 'No data Available', }, height: 200, width: 400, renderTo: Ext.getBody() });
https://fiddle.sencha.com/#fiddle/bvp
source share