check whether there are records in the dataview store from the xtemplate
How can I determine whether there are records in the store from an xtemplate for dataview? I want to display alternative text in case the dataview is empty, for instance: "NO RECORDS TO DISPLAY", or something like that.
There is a configuration option of DataView called emptyText which will give you the desired functionality. Simply put the emptyText config in your DataView constructor and if no records are found it will display that.
Example:
var dv = new Ext.DataView({
emptyText: 'NO RECORDS TO DISPLAY',
// addl configs
});
To answer the initial question, to check to see if there any records you would simply check the datastore directly. You can access it through the store property of a dataview and use the getCount method.
Example:
var count = dv.store.getCount();
#If you have any other info about this subject , Please add it free.# |