you can check dg.dataProvider.length == 0
where should i call the function sir?
because what i did is, i call the function on a button when clicked but
it gives me error
Error #1009: Cannot access a property or method of a null object reference.
you can call this function in creation complete event of datagrid and use event handler to listen.. if datagrid does'nt have any data it will show u an alert box....
use the code that posted in previous post
ahmm..the code above gives
1119: Access of possibly undefined property dataProvider through a reference with static type mx.rpc.http.mxml:HTTPService.
is there something lacking or some packages should i call?
dataProvider is null because it is not set for the datagrid.
so modify your condition like this
if(!dg.dataProvider || dg.dataProvider.length == 0)
you could also listen for the dataChange event of the grid which is triggered whenever the dataProvider is changed if you use a collection as dataProvider.
Try to call this function on DataGrid creation complete or on the Button click you were talking in your post...
private function onDGCreationComplete():void
if(dataGrid.dataProvider == null || dataGrid.dataProvider.length == 0)
Alert.show("DataGrid is Empty.");
If it still doesn't solve your problem then just try to post the sample code you are working on.