Bruno17 / MIGX

MIGX for revo 2.2 and above
84 stars 78 forks source link

CMP grid pagination not working correctly when used with joins (many-to-many) #345

Open travisbotello opened 5 years ago

travisbotello commented 5 years ago

I am using a CMP for my package. The pagination is not working correctly when I add joins to the MIGX-DB configuration. The joins are having a many-to-many relationship and once an item in question is joined with multiple relations the getList pagination on the CMP grid skips an item from the list. Let's say I see 10 items (agendaItem) in the grid per page that have a a single agendaGroup relationship (via agendaItemGroup). Once I add a second group to one of the items the list gets strip to 9 item per page and the 10th item is moved to the second page. Something messes up the correct pagination. See screencast here:

test

Here's the boiled down xml schema regarding these relations:

  <object class="agendaItem" table="agenda_items" extends="xPDOSimpleObject">
    <composite alias="ItemGroups" class="agendaItemGroup" local="id" foreign="item" cardinality="many" owner="local" />
  </object>

  <object class="agendaGroup" table="agenda_groups" extends="xPDOSimpleObject">
    <composite alias="ItemGroups" class="agendaItemGroup" local="id" foreign="group" cardinality="many" owner="local" />
  </object>

  <object class="agendaItemGroup" table="agenda_items_groups" extends="xPDOSimpleObject">
    <aggregate alias="Item" class="agendaItem" local="item" foreign="id" cardinality="one" owner="foreign" />
    <aggregate alias="Group" class="agendaGroup" local="group" foreign="id" cardinality="one" owner="foreign" />
  </object>

Inside my MIGX-DB configuration for agendaItem I am using the following joins value:

[{"alias":"ItemGroups"}]

Setup: