-
29 Oct 2007 1:32 PM #1
[2.0b1] GridView emptyText feature
[2.0b1] GridView emptyText feature
Hi all,
I wanted to show a message in my grid when it was empty, e.g. "No nifty thingies defined" or something. I figured the grid had to have this feature, but I didn't see it in the docs, so I set about trying to figure out what element the body of the grid was (not including the column headers, so not the GridPanel's "body" element) so I could float something above it or just fill it in, etc.
Which lead me to poking around GridPanel.js and GridView.js -- whereupon I found, in GridView, some handling for an "emptyText" data member if it's defined. Excited, I played with it a bit, and found that indeed if I set an emptyText property on the GridView...
...that text gets displayed when the grid is next loaded if there are no records, and isn't displayed if there are records! Exactly what I wanted!Code:myGridPanel.getView().emptyText = 'No nifty thingies defined...';
There are no setters/getters (so for instance, if you want to change the empty text, you have to change the property and then either cause a reload or -- if you're feeling really cheeky -- call the GridView.applyEmptyText private internal might-change-at-any-moment method), and it's not documented, nor is it available via config options. So I'm wondering whether this is something that's not quite complete but is planned, or someone got half-way done and got distracted, or...?
Thanks in advance,T.J. Crowder
tj / crowdersoftware / com
-
29 Oct 2007 1:40 PM #2Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
29 Oct 2007 2:03 PM #3
Ah, thanks Tim! Good news, it'll be documented (for us non-SVN plebes) soon, and for the casual readers of this thread two points:
- It is exposed as a config item, it's just a config item for the view, not the grid, so put it in viewConfig.
- It's even marked up with the x-grid-empty style, so if you want to change the default styling, it's easy to do.
Very nice.T.J. Crowder
tj / crowdersoftware / com


Reply With Quote