2 Replies Latest reply on Jun 25, 2010 5:08 AM by pam.lc

    Duplicate rows in AdvancedDataGrid when pushing updates via custom Assembler?

    klopus-normalis

       

      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!