2 Replies Latest reply on Jun 21, 2007 8:19 AM by csawall

    Howto clear datagrid contents?

    csawall Level 1
      Is there an easy way to simply clear all the contents that were previously displayed in a datagrid?

      I have a datagrid, when a user logs in, they can hit refresh and it will populate the datagrid. But I would like to clear the contents when the user logs off. Or simply by clicking a button to clear all of the contents.

      Does anyone have any ideas on this? I've searched the forums, but nothing popped up.

      Thanks,
      Chris
        • 1. Re: Howto clear datagrid contents?
          ntsiii Level 3
          EVERYTHING you do with a list-based component like DataGrid should be done on the dataProvider.

          Each dataProvider type provides its own specific API. For example, XMLListCollection has the method "removeAll()".

          See the docs for the dataProvider type you are using.

          Tracy
          • 2. Re: Howto clear datagrid contents?
            csawall Level 1
            So I have this function to create my output that I use to populate the datagrid:

            [Bindable] public var _xmlReturnHTML:XML;
            private function chkoutput(evt:ResultEvent):void {
            _xmlReturnHTML = XML(evt.result);
            }

            Can I simply do this (below) and set it equal to nothing? It seems to work, but I want to check to see if it's acceptable?
            _xmlReturnHTML.files='';

            Thanks for your time.

            Chris