Skip to content

Commit 5ff20ff

Browse files
author
jefffischer
committed
Merge pull request BroadleafCommerce#11 from BroadleafCommerce/qa-732-scroll
collection grids in Entity forms weren't paging correctly
2 parents ee613c2 + 8e57484 commit 5ff20ff

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/server/service/AdminEntityService.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,20 @@ public Map<String, DynamicResultSet> getRecordsForAllSubCollections(PersistenceP
252252
Entity containingEntity, List<SectionCrumb> sectionCrumb)
253253
throws ServiceException;
254254

255+
/**
256+
* overloading containing paging parameters
257+
* @param ppr
258+
* @param containingEntity
259+
* @param startIndex
260+
* @param maxIndex
261+
* @param sectionCrumb
262+
* @return
263+
* @throws ServiceException
264+
*/
265+
public Map<String, DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr,
266+
Entity containingEntity, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb)
267+
throws ServiceException;
268+
255269
/**
256270
* Adds an item into the specified collection
257271
*

admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/server/service/AdminEntityServiceImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,23 +351,30 @@ public PersistenceResponse getRecordsForCollection(ClassMetadata containingClass
351351
}
352352

353353
@Override
354-
public Map<String, DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, List<SectionCrumb> sectionCrumb)
354+
public Map<String, DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, Integer startIndex, Integer maxIndex, List<SectionCrumb> sectionCrumb)
355355
throws ServiceException {
356356
Map<String, DynamicResultSet> map = new HashMap<String, DynamicResultSet>();
357357

358358
PersistenceResponse response = getClassMetadata(ppr);
359359
ClassMetadata cmd = response.getDynamicResultSet().getClassMetaData();
360360
for (Property p : cmd.getProperties()) {
361-
if (ArrayUtils.contains(p.getMetadata().getAvailableToTypes(), containingEntity.getType()[0])
361+
if (ArrayUtils.contains(p.getMetadata().getAvailableToTypes(), containingEntity.getType()[0])
362362
&& p.getMetadata() instanceof CollectionMetadata) {
363-
PersistenceResponse response2 = getRecordsForCollection(cmd, containingEntity, p, null, null, null, sectionCrumb);
363+
PersistenceResponse response2 = getRecordsForCollection(cmd, containingEntity, p, null, startIndex, maxIndex, sectionCrumb);
364364
map.put(p.getName(), response2.getDynamicResultSet());
365365
}
366366
}
367367

368368
return map;
369369
}
370370

371+
@Override
372+
public Map<String, DynamicResultSet> getRecordsForAllSubCollections(PersistencePackageRequest ppr, Entity containingEntity, List<SectionCrumb> sectionCrumb)
373+
throws ServiceException {
374+
375+
return getRecordsForAllSubCollections(ppr, containingEntity, null, null, sectionCrumb);
376+
}
377+
371378
@Override
372379
public PersistenceResponse addSubCollectionEntity(EntityForm entityForm, ClassMetadata mainMetadata, Property field,
373380
Entity parentEntity, List<SectionCrumb> sectionCrumbs)

admin/broadleaf-open-admin-platform/src/main/resources/open_admin_style/js/admin/components/listGrid-paginate.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -677,14 +677,7 @@
677677

678678
// Fetch records if necessary
679679
$.doTimeout('fetch', fetchDebounce, function() {
680-
if (singleGrid) {
681-
var url = null;
682-
} else if (isAssetGrid) {
683-
var url = $tbody.closest('table').data('currenturl');
684-
} else {
685-
var url = $tbody.closest('table').data('path');
686-
}
687-
680+
var url = $tbody.closest('table').data('path');
688681
BLCAdmin.listGrid.paginate.loadRecords($tbody, url);
689682
});
690683

0 commit comments

Comments
 (0)