[Bindable]
public var partyQuery:PagedQuery;
public var partyService:PartyService;
private function init():void {
Spring.getInstance().initApplication();
Spring.getInstance().mainServerSession.serverApp =
new SimpleServerApp("/server", false, "localhost", "8080");
Spring.getInstance().addComponent("partyService", PartyService);
Spring.getInstance().addComponentWithFactory("partyQuery", PagedQuery,
{ maxResults: 40, methodName: "findPersonByFilter", remoteComponentClass: PartyService, elementClass: Person });
var context:Context = Spring.getInstance().getSpringContext();
partyQuery = context.partyQuery;
partyQuery.multipleSort = true;
partyQuery.sort = new Sort();
partyQuery.sort.fields = [ new SortField("id") ];
partyQuery.refresh();
partyService = context.byType(PartyService) as PartyService;
Spring.getInstance().addComponent("dataTopic", DataObserver);
context.dataTopic.subscribe();
}
...........
<mx:AdvancedDataGrid id="productGrid" width="100%" height="100%" dataProvider="{partyQuery}" top="20" sortableColumns="true">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="id" dataField="id" width="100"/>
<mx:AdvancedDataGridColumn headerText="First Name" dataField="currentFirstName" width="100"/>
<mx:AdvancedDataGridColumn headerText="Last Name" dataField="currentLastName" width="100"/>
<mx:AdvancedDataGridColumn headerText="DOB" dataField="birthDate"/>
</mx:columns>
</mx:AdvancedDataGrid>
Flex 4 Spark controls do not handle ItemPendingError
by themselves and need a special wrapper AsyncListView
.
<mx:AdvancedDataGrid id="productGrid" width="100%" height="100%" dataProvider="{dataProvider}" top="20" sortableColumns="true">
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/collections/AsyncListView.html