@onehat/data 1.19.9 → 1.19.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -583,6 +583,15 @@ describe('Repository Base', function() {
|
|
|
583
583
|
expect(this.repository.page).to.be.eq(1);
|
|
584
584
|
});
|
|
585
585
|
|
|
586
|
+
it('setIsPaginated', function() {
|
|
587
|
+
|
|
588
|
+
this.repository.setIsPaginated(true);
|
|
589
|
+
expect(this.repository.isPaginated).to.be.true;
|
|
590
|
+
|
|
591
|
+
this.repository.setIsPaginated(false);
|
|
592
|
+
expect(this.repository.isPaginated).to.be.false;
|
|
593
|
+
});
|
|
594
|
+
|
|
586
595
|
});
|
|
587
596
|
|
|
588
597
|
describe('creating', function() {
|
package/package.json
CHANGED
package/src/Repository/Ajax.js
CHANGED
|
@@ -362,8 +362,8 @@ class AjaxRepository extends Repository {
|
|
|
362
362
|
* Refreshes entities.
|
|
363
363
|
*/
|
|
364
364
|
_onChangePagination = () => {
|
|
365
|
-
this.setBaseParam(this.paramPageNum, this.page);
|
|
366
|
-
this.setBaseParam(this.paramPageSize, this.pageSize);
|
|
365
|
+
this.setBaseParam(this.paramPageNum, this.isPaginated ? this.page : null);
|
|
366
|
+
this.setBaseParam(this.paramPageSize, this.isPaginated ? this.pageSize : null);
|
|
367
367
|
|
|
368
368
|
if (this.isLoaded && !this.eventsPaused) {
|
|
369
369
|
return this.reload();
|
|
@@ -801,8 +801,25 @@ export default class Repository extends EventEmitter {
|
|
|
801
801
|
this.setPage(1);
|
|
802
802
|
}
|
|
803
803
|
|
|
804
|
+
/**
|
|
805
|
+
* Sets isPaginated
|
|
806
|
+
*/
|
|
807
|
+
setIsPaginated = (bool) => {
|
|
808
|
+
if (this.isDestroyed) {
|
|
809
|
+
this.throwError('this.setIsPaginated is no longer valid. Repository has been destroyed.');
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
this.isPaginated = bool;
|
|
813
|
+
|
|
814
|
+
if (this._onChangePagination) {
|
|
815
|
+
return this._onChangePagination();
|
|
816
|
+
}
|
|
817
|
+
return true;
|
|
818
|
+
}
|
|
819
|
+
|
|
804
820
|
/**
|
|
805
821
|
* Sets the pageSize
|
|
822
|
+
* @fires changePage
|
|
806
823
|
* @fires changePageSize
|
|
807
824
|
*/
|
|
808
825
|
setPageSize = (pageSize) => {
|
|
@@ -834,6 +851,7 @@ export default class Repository extends EventEmitter {
|
|
|
834
851
|
/**
|
|
835
852
|
* Advances to a specific page of entities
|
|
836
853
|
* @return {boolean} success
|
|
854
|
+
* @fires changePage
|
|
837
855
|
*/
|
|
838
856
|
setPage = (page) => {
|
|
839
857
|
if (this.isDestroyed) {
|