Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Duplicate rows in AdvancedDataGrid when pushing updates via custom Assembler?

Avatar

Level 1

We are trying to use LCDS transactions to dynamically push updates from a server side application via custom Assembler to AdvancedDataGrid.  Latter is using fill result ArrayList as its data source.

Unfortunately we haven't been fully successful thus far. Grid shows fine initial snapsot delivered by fill but subsequent record updates result in a duplicate rows shown in a grid. 

We are using Flex 3, SDK 3.5 and LCDS ES 2.6.1.

Here is the relevant code in our custom assembler to do the update push:

_results.add(dataUpdate); // _results is the ArrayList object returned with data on the original fill

 

DataServiceTransaction dtx = DataServiceTransaction.begin("FOO", false);

dtx.addItemToFill(_assemblerId, _currentParams, _results.size()-1,dataUpdate);
 

dtx.commit();

// we see this method gets called as result of the code above

public Object getItem(Map identity) {

      Object item = null;

      String id = identity.get("ID").toString();

      for (LinkedHashMap<String,Object> itemMap : _results) {

      if (itemMap.get("ID").equals(id)) {

            item = itemMap;

       break;

      }

      }

      return item;

}

And finally here is the destination configuration for the assembler in the data-management-config.xml file:

<destination id="updates">

  <properties>    

         <source>UpdatesAssembler</source>

        <scope>session</scope>

  <auto-sync-enabled>false</auto-sync-enabled>

  <metadata>

                 <identity property="ID"/>

  </metadata>

 

  <network>

                 <paging enabled="false"/>

  </network>

</properties>

</destination>

And naturally, we bind the datagrid dataProvider to the array collection returned by the original fill call.

As stated above, this solution results in two rows of the same data appearing in datagrid for every updated pushed by the assembler.

Can you please advise what are we doing wrong.

Thanks!

2 Replies

Avatar

Level 1

What events are coming back to the client?

If you add an event listener to the dataService object in ActionScript, you can see what events are coming in.

    dataService.addEventListener(MessageEvent.RESULT, resultHandler);

This might help diagnose it.

Avatar

Level 1

You can also inspect the messages being sent over the wire from the server by setting your logging filters in service-config.xml.

Look to see, if the id's for the objects are what you expect them to be.

Please post the information to the thread.