PDA

View Full Version : emptyText in GridPanel does not show



srh124
16 Dec 2015, 5:08 AM
Hi all.
I have a grid panel for displaying results of a search. but when there is no result returned by server, gridpanel does not show emptyText, while it displays column headers.
This is my code (after getting results from server):

if (gridPanel2) {
gridPanel2.destroy();
}
gridPanel2 = Ext.create('Ext.grid.GridPanel', {
title: "Results",

viewConfig: {
emptyText: 'No records',
deferEmptyText: false
},
//region: "east",
store: store2,
width: 340,
autoHight: true,
columns: [{
menuDisabled: true,
sortable: false,
width: 30,
xtype: 'gx_symbolizercolumn',
dataIndex: "symbolizer"
}, {
header: "FName",
width: 200,
dataIndex: "FNAME"
}, {
header: "MapID",
width: 100,
dataIndex: "MAPID"
}],
selType: 'featuremodel',

});

formPanel.add(gridPanel2);



Any advice?

Gary Schlosberg
16 Dec 2015, 7:56 AM
Are you able to recreate this issue in a Fiddle so we can get a better idea what might be happening?
https://fiddle.sencha.com/#home

srh124
16 Dec 2015, 1:55 PM
I'm not familiar with fiddle. Though, I think it's not possible to reproduce the problem because i'm using GeoExt and GeoServer.

This is the code for store, just before gridPanel. I can make sure (via firebug) that store is empty.


store2 = Ext.create('GeoExt.data.FeatureStore',{
layer: vecLayer,
fields: [ {name: 'FNAME', type: 'string'},
{name: 'MAPID', type: 'float'}
] ,
autoLoad: false
});

I'm nearly a beginner in Ext JS. I had already searched internet but all soultions was about specifying deferEmptyText: false or autoHight: true .


Also, is it right to see column headers without any row?

srh124
17 Dec 2015, 6:27 AM
I finally could solve the problem. I added height: 100 for gridPanel and now emptyText appears.
As i understood, autoHeight is for before ExtJS 4 and hence doesn't work. Unfortunately height: '100%' does not work and does not show emptyText.
Final Solution for me: using minHeight:100

Gary Schlosberg
17 Dec 2015, 8:36 AM
Glad to hear you found your solution. Yes the height (http://docs.sencha.com/extjs/4.2.5/#!/api/Ext.grid.Panel-cfg-height) config only takes a number so '100%' is not valid.