7. Paged Collections

 Documentation Summary
 Page Summary

Using the PagedQuery Component

The PagedQuery component provides a client view on a remote Query component. It extends ListCollectionView, and thus can be used as a data provider for any Flex UI component.

The collection is completely paged and keeps in memory only the data needed for the current display. In fact, it has to keep two complete pages to avoid too many server calls.

It supports automatic remote sorting and filtering. The server-side part of the paging depends on the server technology and is described in the next paragraphs.

On the client-side, you have to register the client component with:

<mx:Script>
  <![CDATA[
    Seam.getInstance().addComponent("people", PagedQuery);
  ]]>
</mx:Script>

This registers a client component with a page size defined by the server. It's also possible to define the page size on the client with :

<mx:Script>
  <![CDATA[
    Seam.getInstance().addComponentWithFactory("people", PagedQuery, { maxResults: 36 });
  ]]>
</mx:Script>

When using the Tide client framework, that can be done in a Tide module initializer as any other component declaration.

It is important that this registration is done in a static block initializer of the main MXML class, because it has to be defined before the first reference in a component, and in particular before any data binding on context.people is initialized by Flex.

That's all. Just bind the component as a data provider for any component and it should work as expected:

<mx:DataGrid id="people" dataProvider="{ctx.people}" width="100%" height="100%"
    liveScrolling="false">
    <mx:columns>
        <mx:DataGridColumn dataField="firstName" headerText="First name"/>
        <mx:DataGridColumn dataField="lastName" headerText="Last name"/>
    </mx:columns>
</mx:DataGrid>

The DataGrid sorting triggers a remote refresh of the collection, and the changes on the data filter are maintained during the remote refresh, so the filtering is also done remotely.

It is important to disable liveScrolling to avoid excessive remote traffic.

Like the paged collections of LCDS, everything works only if there is a correct uid property on the entities. It is thus recommended to use the Tide templates for the Gas3 generator, which provide a default implementation of uid if there is no uid property on the entities.


Browse Space

- Pages
- Blog
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

Other Features

Add Content


Copyright © 2011 Granite Data Services S.A.S. All Rights Reserved.