@@ -39,6 +39,7 @@ const template = `
3939
4040import { Component , Prop , Vue } from 'vue-property-decorator'
4141import { PageCollection , IResource } from '@simpli/resource-collection'
42+ import AdapTableWrapper from './index'
4243
4344@Component ( { template } )
4445export class AdapPagination extends Vue {
@@ -61,43 +62,85 @@ export class AdapPagination extends Vue {
6162 }
6263
6364 async goto ( n : number ) {
65+ const options = AdapTableWrapper . options
66+
6467 try {
6568 this . $emit ( 'beforeGoto' )
66- PageCollection . defaultBeforeQueryAction ( )
69+
70+ if ( options . defaultBeforeQueryAction ) {
71+ options . defaultBeforeQueryAction ( )
72+ }
73+
6774 await this . collection . queryCurrentPage ( n - 1 )
75+
6876 this . $emit ( 'afterGoto' )
69- PageCollection . defaultAfterQueryAction ( )
77+
78+ if ( options . defaultAfterQueryAction ) {
79+ options . defaultAfterQueryAction ( )
80+ }
7081 } catch ( e ) {
7182 this . $emit ( 'errorGoto' )
72- PageCollection . defaultErrorQueryAction ( )
83+
84+ if ( options . defaultErrorQueryAction ) {
85+ options . defaultErrorQueryAction ( )
86+ }
87+
7388 throw e
7489 }
7590 }
7691
7792 async next ( ) {
93+ const options = AdapTableWrapper . options
94+
7895 try {
7996 this . $emit ( 'beforeNext' )
80- PageCollection . defaultBeforeQueryAction ( )
97+
98+ if ( options . defaultBeforeQueryAction ) {
99+ options . defaultBeforeQueryAction ( )
100+ }
101+
81102 await this . collection . queryNextPage ( )
103+
82104 this . $emit ( 'afterNext' )
83- PageCollection . defaultAfterQueryAction ( )
105+
106+ if ( options . defaultAfterQueryAction ) {
107+ options . defaultAfterQueryAction ( )
108+ }
84109 } catch ( e ) {
85110 this . $emit ( 'errorNext' )
86- PageCollection . defaultErrorQueryAction ( )
111+
112+ if ( options . defaultErrorQueryAction ) {
113+ options . defaultErrorQueryAction ( )
114+ }
115+
87116 throw e
88117 }
89118 }
90119
91120 async prev ( ) {
121+ const options = AdapTableWrapper . options
122+
92123 try {
93124 this . $emit ( 'beforePrev' )
94- PageCollection . defaultBeforeQueryAction ( )
125+
126+ if ( options . defaultBeforeQueryAction ) {
127+ options . defaultBeforeQueryAction ( )
128+ }
129+
95130 await this . collection . queryPrevPage ( )
131+
96132 this . $emit ( 'afterPrev' )
97- PageCollection . defaultAfterQueryAction ( )
133+
134+ if ( options . defaultAfterQueryAction ) {
135+ options . defaultAfterQueryAction ( )
136+ }
98137 } catch ( e ) {
99138 this . $emit ( 'errorPrev' )
100- PageCollection . defaultErrorQueryAction ( )
139+
140+ if ( options . defaultErrorQueryAction ) {
141+ options . defaultErrorQueryAction ( )
142+ }
143+
101144 throw e
102145 }
103146 }
0 commit comments