0 Replies Latest reply on Aug 17, 2011 12:48 AM by RonaldKamp

    LCDS data paging to AsyncListView with itemRenderer throws nullpointer

    RonaldKamp

      Hi,

       

      My name is Ronald Kamp and I'm a junior Java/Flex developer at Ordina Belgium. I'm having some difficulty with LiveCycle data services data paging.

       

      I have a java backend that has a list of bankaccounts. These accounts have movement. Because the list of movements can be quite large, we are trying to use datapaging.

       

      For now, we have 2 destinations, one for the accounts and one for the movements.

       

      There is one line in comment for the account, the one-to-many for the movements. For now, we still address the movement destination for the movements of a specific account. (if you have any idea how to make the one-to-many working, let me know, it throws an exception that it cannot find the getItem method, even though I implemented all of them in the assembler). That beside the question at the moment.

       

       

           <destination id="account">

                <adapter ref="java-dao" />

                <properties>

                     <use-transactions>false</use-transactions>

                     <factory>spring</factory>

                     <source>accountAssembler</source>

                     <metadata>

                          <identity property="bebanNumber" />

                          <!--<one-to-many property="movements" destination="movement" lazy="false" page-size="50"/>-->

                     </metadata>

                     <item-class>be.ordina.mobile.dl.domain.Account</item-class>

                </properties>

           </destination>

       

           <destination id="movement">

                <adapter ref="java-dao" />

                <properties>

                     <use-transactions>false</use-transactions>

                     <factory>spring</factory>

                     <source>movementAssembler</source>

                     <metadata>

                          <identity property="id" />

                     </metadata>

                     <network>

                          <paging enabled="true" pageSize="50" />

                     </network>

                     <item-class>be.ordina.mobile.dl.domain.Movement</item-class>

                </properties>

           </destination>

       

       

       

      On the flex side, when a specific account is selected, the movements are filled for that account and the movements screen is shown. The following code handles this functionality:

       

      Accounts.mxml:

       

           protected function accountsList_changeHandler(event:IndexChangeEvent):void

           {

                var currentAccount:Account = (accountsList.selectedItem as Account)

                var selectedBebanNumber:String = currentAccount.bebanNumber;

       

                var movements:ArrayCollection = new ArrayCollection();

                ApplicationContext.services.movementsDataService.fill(movements, selectedBebanNumber);

                trace("movements paging? " + ApplicationContext.services.movementsDataService.pagingEnabled.toString());

                navigator.pushView(Movements,  {beban:selectedBebanNumber, movements:movements});

       

       

       

           }

       

       

      Movements.mxml:

           override public function set data(value:Object):void

           {

                 super.data = value;

                movements = value.movements as ArrayCollection;

       

                title = "Movements for \n " + value.beban;

           }

       

           <s:List id="movementsList"  width="100%" height="100%"  itemRenderer="be.ordina.renderer.MovementIconRenderer"                 change="movementsList_changeHandler(event)" >

                <s:AsyncListView list="{movements}"  createPendingItemFunction="createPendingItem"

                           createFailedItemFunction="createFailedItem"/>

           </s:List>

       

      This throws the following error: TypeError: Error #1009: Cannot access a property or method of a null object reference.

       

      I do not know what I am doing wrong. The createPendingItemFunction and createFailedItemFunction are implemented but it still wants to fill up my item renderers to early.

       

      Could somebody help me with this problem?

       

      Thanks in advance!

       

      Kind regards,

       

      Ronald Kamp