Hi,

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;

reviewsCollection.refresh();

//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:HBox>

<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:HBox>

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

<mx:columns>

<mx:Array>

<!– Something that shows that the data provider gets
sorted based on the reviewer –>

<mx:DataGridColumn dataField=”reviewer”
headerText=”Reviewer”/>

</mx:Array>

</mx:columns>

</mx:DataGrid>

<!– Custom Repeater Component that takes
reviewsCollection as the dataProvider –>

<ReviewThumbnailRepeater id=”rtr”
dataProvider=”{reviewsCollection}” project=”{project}”
width=”100%”/>

</mx:VBox>

</mx:VBox>

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

Related posts:

  1. Refresh Component After sorting dataprovider
  2. Implementing dataProvider in custom component
  3. Access properties of component within an itemRenderer
  4. supported date formats for sorting
  5. Custom Component in Combobox

Related posts brought to you by Yet Another Related Posts Plugin.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 free icons download Suffusion theme by Sayontan Sinha

Featuring Recent Posts WordPress Widget development by YD