LiveCycle Data Services. I’ve mentioned it before.
It can be an indispensable tool. But like any good black box, getting it to work properly is a huge pain in the ass.
One of the biggest benefits of LCDS is paging. Paging lets you dynamically load data as soon as it’s accessed within a collection. This is great for large data sets, and the beauty of this approach is that you don’t have to do anything special for it to work.
Create a collection, bind it to your view, and connect it to a data service. As you interact with the view, LCDS will automatically retrieve the data in the background.
But let’s say you want to use a custom component instead of a standard
DataGrid to display your data. This is where the magic breaks down.
You see, LCSD only works “as advertised” when you use built-in components. Any Flex component that can accept an
ICollectionView as a
dataProvider has specific logic to handling paging.
This is because paging is just a series of asynchronous remoting calls performed behind the scenes. When a component tries to access data that isn’t available, an
ItemPendingError is thrown and a remoting call is made to retrieve it.
Since there’s nothing to access right away, the component will substitute a placeholder in lieu of the actual data. When the remoting call returns, the component will then swap out the placeholder for the data.
This is all fine and good, even though it does reveal somewhat how the sausage is being made. You just don’t get any of this for free if you use your own custom component.
However this doesn’t mean it’s impossible. You just have to support the asynchronous method in which the data is accessed – something I’ll detail in a future post.