0 Replies Latest reply on Feb 10, 2007 3:43 PM by WestSide

    Hide <mx:Tree> ??

    WestSide Level 1
      Hi,

      I have the following code:

      <comps:CTypes id="cTypeCB" change="loadCompaniesByType(event)" />

      When the loadCompaniesByType() is called I make a remote object call and get some xml from the server. This works fine, but the problem is the tree still displays, its just empty. I see a generic graphic icon but no values of course because the xml is empty. I do not want it this way, i want to just display a message, no tree if the xml is empty. Since the tree mxml code is in my view, I am not sure how to hide the tree if the xml is empty.

      If I could guarantee data would always come back in my xml from the remote object call then I would be good, but I think if no xml comes back I should just display a message to the user, but the tree should not be shown at all.

      if(event.result == "") {
      Alert.show('No Data Found');
      }
      else {
      model.treeData = new XML(event.result);
      }

      In my view:

      <mx:Tree id="acTree"
      width="100%"
      height="100%"
      showRoot="false"
      labelField="@name"
      change="treeChanged(event)"
      dataProvider="{model.treeData}"

      />


      Hope that makes sense

      -Westside