3 Replies Latest reply on May 1, 2006 1:32 PM by ur_dtrain

    DataGrid no refresh on empty result


      Im trying to use Flex graphic enviroment with Ruby on Rails Server.
      I have a page where you can filter products by price range, you select the range and press "Filter" button,
      it execute public function filter(minimum:int, maximum:int):void

      Works fine when the result are one or more products,
      BUT, when result is empty, the DataGrid donnot refresh.

      In this case, How clean content of dataGrid? and show it empty?

      Here is the code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*"
      paddingTop="0" paddingLeft="0" paddingRight="0" paddingBottom="0"
      backgroundColor="#FFFFFF" creationComplete="srv.send()" viewSourceURL="srcview/index.html">
      <mx:Label text="Label" id="miLabel"/>

      public var min:int = 0;
      public var max:int = 1000;
      public var MyUrl:String = ' http://localhost:3000/store/productlist?from=' + min +'&to='+min
      private var _camera:Boolean;
      private var _video:Boolean;
      private var _triband:Boolean;

      public function filter(minimum:int, maximum:int):void
      min = minimum;
      max = maximum;
      srv.url = ' http://localhost:3000/store/productlist?from=' + min +'&to='+max;
      miLabel.text = srv.url;


      <mx:HTTPService id="srv" url="{MyUrl}"/>

      <mx:DataGrid id="gridlist" dataProvider="{srv.result.list.product}" height="500" showHeaders="true" themeColor="haloSilver">
      <mx:DataGridColumn headerText="Column 1" dataField="name"/>
      <mx:DataGridColumn headerText="Column 2" dataField="description"/>
      <mx:DataGridColumn headerText="Column 3" dataField="price"/>

      <fab:FABridge xmlns:fab="bridge.*" />


      XML returns:
      On request >>> http://localhost:3000/store/productlist?from=200&to=300
      Returns this XML>>>
      <name>Nokia 6820x</name>
      <description>Nokia 6820</description>
      <price currency="USD">299.99</price>

      And this information is displayed

      But when request >>>> http://localhost:3000/store/productlist?from=300&to=300
      Returns zero, this XML>>>

      The list is empty, by the dataGrid continuous showing the previous information, when should be empty.