PDA

View Full Version : Validating if the Ext.grid.panel is empty



nir2211
4 Apr 2013, 4:39 AM
I am trying to create a grid panel, that should highlight the grid in red, (as it happens when the validations fail on other components,) when the grid is empty. Is there a simple solution for this?

existdissolve
4 Apr 2013, 5:52 AM
I am trying to create a grid panel, that should highlight the grid in red, (as it happens when the validations fail on other components,) when the grid is empty. Is there a simple solution for this?


Define "empty" for a grid panel? No data records as part of its store, or no docked items, etc.?

If you are talking about data, you could easily check whether the grid's store has data, and then addCls() on the grid to show some kind of validation warning (you could even add a quick tip to it).

nir2211
5 Apr 2013, 2:07 AM
Thanks for the reply. I meant (no of rows = 0 ) when i mentioned empty.

slemmon
5 Apr 2013, 10:23 PM
You may find the grid's getStore (http://docs.sencha.com/ext-js/4-2/#!/api/Ext.grid.Panel-method-getStore)() method handy along with store's getCount (http://docs.sencha.com/ext-js/4-2/#!/api/Ext.data.Store-method-getCount)() method.