2 Replies Latest reply on Jan 15, 2010 8:53 AM by Gregory Lafrance

    Message when datagrid is empty


      I need to display dataGrid headers and the "no records" message when the
      DataGrid is empty, is there any way to achieve this?




        • 1. Re: Message when datagrid is empty

          Hope this link would give you some idea,



          • 2. Re: Message when datagrid is empty
            Gregory Lafrance Level 6

            This code answers your question:


            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
                  import mx.controls.Alert;
                  import mx.collections.ArrayCollection;
                  [Bindable] private var ac:ArrayCollection = new ArrayCollection([]);
                  private function checkDP():void {
                    if(ac.length == 0){
                      mx.controls.Alert.show("DataGrid dataProvider is empty!");
              <mx:DataGrid dataProvider="{ac}" creationComplete="checkDP()">
                  <mx:DataGridColumn dataField="test1"/>
                  <mx:DataGridColumn dataField="test2"/>
                  <mx:DataGridColumn dataField="test3"/>
                  <mx:DataGridColumn dataField="test4"/>
                  <mx:DataGridColumn dataField="test5"/>


            If this post answers your question or helps, please mark it as such.

            Greg Lafrance - Flex 2 and 3 ACE certified


            Flex / AIR Development, Training, and Support Services