1 Reply Latest reply on Nov 14, 2006 1:33 PM by dallaswebb

    Refresh Component After sorting dataprovider

      I'm trying to refresh a custom component that displays a dataprovider which I sort. Below is my code. Thanks in advance.

      ... // one of the sorting functions
      private function sortOnDate():void
      var sortDate:Sort = new Sort();
      sortDate.fields = [new SortField("date", true, true), new SortField("reviewer")];
      reviewsCollection.sort = sortDate;
      //reviews = reviews.sortOn("date");


      <mx:DateFormatter id="df" formatString="MMMM DD, YYYY"/>

      <mx:HBox horizontalGap="4" width="100%" horizontalAlign="left">
      <mx:Label text="Reviews" fontSize="12" fontWeight="bold"/>

      <mx:VBox id="reviewsBox" width="100%" height="100%" minHeight="0" borderStyle="outset" verticalGap="0" horizontalScrollPolicy="off">

      <mx:HBox id="header" paddingLeft="4" width="100%" backgroundColor="#CCCCCC">
      <mx:Label text="Rating" width="100" click="sortOnRating();"/>
      <mx:VRule height="18"/>
      <mx:Label text="Reviewer" width="120" click="sortOnReviewer();"/>
      <mx:VRule height="18"/>
      <mx:Label text="Date" width="120" click="sortOnDate();"/>

      <mx:DataGrid id="dg" dataProvider="{reviewsCollection}" width="100%" height="50%">

      <!-- Something that shows that the data provider gets sorted based on the reviewer -->
      <mx:DataGridColumn dataField="reviewer" headerText="Reviewer"/>


      <!-- Custom Repeater Component that takes reviewsCollection as the dataProvider -->
      <ReviewThumbnailRepeater id="rtr" dataProvider="{reviewsCollection}" project="{project}" width="100%"/>


      Here's the question. How can I make the custom component redraw after the data provider is sorted?