Thursday, October 11, 2007

Async refresh of GroupingCollection

In Flex 3 Beta-2, GroupingCollection adds support for asychronous refresh. When we have large number of input rows or don't want to wait for the grouping to finish to see the results we can pass true to GroupingCollection.refresh(async:Boolean) and get to view the results as the grouped data is built. Users are allowed to interact with the shown information. Refresh can be even stopped by calling cancelRefresh.

I wrote a small app to test this. The app generates random data and displays it in AdvancedDataGrid(ADG) when "Populate ADG" is clicked. The number of data rows can be modified using the numeric stepper. A click on "Group" starts async refresh and ADG starts displaying the results immediately. Grouping can be cancelled any time using "Cancel Grouping". The three check boxes allow different combinations of grouping to be performed.

Option to pause/resume a refresh is not available.

The source is available here.


Rohit said...

Hi I am Rohit. I liked the test application that you have posted. Is it possible to share the source code of the example. I wanted to understand the grouping and the async refresh thats happening.

Sreenivas said...

I have posted the link to source in the main topic.

Rohit said...

Thanks a lot.

Vimmy said...

Great example. Thanks a lot.

How to provide summay (count) at each group level?


Sreenivas said...

summaryPlacement="group" should help.

Vijay Mareddy said...

Nice example Sreenivas... Now which method on the GroupingCollection will tell me that grouping thread is busy ...i would like to display a message to the user that the grouping is going on... and when the grouping is done ...i would clear the info text message

Vijay Mareddy said...

Found the answer:
function(e:CollectionEvent):void {
if(e.kind == CollectionEventKind.REFRESH){
trace('groupingCollection is refreshed*************');

Vijay Mareddy said...

GroupingCollection2.refresh(true) does not render one at a time instead it renders the whole report all at once.

My comments related to this at the end of this JIRA

Paul Smith said...

Really? The three check boxes allow different combinations of grouping to be performed, correct? This is great! I am impressed by this news!
Best wishes,
editing services uk -