Fixed #163 - DataTable onPage event fires without sort and filter information
parent
5a546a356a
commit
cf438de260
|
@ -451,9 +451,13 @@ export default {
|
|||
this.d_first = event.first;
|
||||
this.d_rows = event.rows;
|
||||
|
||||
let pageEvent = this.createLazyLoadEvent(event);
|
||||
pageEvent.pageCount = event.pageCount;
|
||||
pageEvent.page = event.page;
|
||||
|
||||
this.$emit('update:first', this.d_first);
|
||||
this.$emit('update:rows', this.d_rows);
|
||||
this.$emit('page', event);
|
||||
this.$emit('page', pageEvent);
|
||||
},
|
||||
onColumnHeaderClick(e) {
|
||||
const event = e.originalEvent;
|
||||
|
@ -483,12 +487,7 @@ export default {
|
|||
this.$emit('update:sortOrder', this.d_sortOrder);
|
||||
this.$emit('update:multiSortMeta', this.d_multiSortMeta);
|
||||
|
||||
this.$emit('sort', {
|
||||
originalEvent: event,
|
||||
sortField: this.d_sortField,
|
||||
sortOrder: this.d_sortOrder,
|
||||
multiSortMeta: this.d_multiSortMeta
|
||||
});
|
||||
this.$emit('sort', this.createLazyLoadEvent(event));
|
||||
|
||||
this.resetPage();
|
||||
}
|
||||
|
@ -608,10 +607,9 @@ export default {
|
|||
filteredValue = data;
|
||||
}
|
||||
|
||||
this.$emit('filter', {
|
||||
filters: this.filters,
|
||||
filteredValue: filteredValue
|
||||
});
|
||||
let filterEvent = this.createLazyLoadEvent(event);
|
||||
filterEvent.filterValue = filteredValue;
|
||||
this.$emit('filter', filterEvent);
|
||||
|
||||
return filteredValue;
|
||||
},
|
||||
|
@ -1598,7 +1596,19 @@ export default {
|
|||
rows: this.rows * 2
|
||||
});
|
||||
}, this.virtualScrollDelay);
|
||||
}
|
||||
},
|
||||
createLazyLoadEvent(event) {
|
||||
return {
|
||||
originalEvent: event,
|
||||
first: this.d_first,
|
||||
rows: this.d_rows,
|
||||
sortField: this.d_sortField,
|
||||
sortOrder: this.d_sortOrder,
|
||||
filters: this.filters,
|
||||
globalFilter: this.filters && this.filters['global'] ? this.filters['global'].value : null,
|
||||
multiSortMeta: this.d_multiSortMeta
|
||||
};
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
containerClass() {
|
||||
|
|
|
@ -1973,23 +1973,42 @@ export default {
|
|||
<td>event.page: New page number <br/>
|
||||
event.first: Index of first record <br/>
|
||||
event.rows: Number of rows to display in new page <br/>
|
||||
event.pageCount: Total number of pages
|
||||
event.pageCount: Total number of pages <br />
|
||||
event.sortField: Field to sort against <br />
|
||||
event.sortOrder: Sort order as integer <br />
|
||||
event.multiSortMeta: MultiSort metadata <br />
|
||||
event.filters: Collection of active filters <br />
|
||||
event.filteredValue: Filtered collection
|
||||
</td>
|
||||
<td>Callback to invoke on pagination.</td>
|
||||
<td>Callback to invoke on pagination. Sort and Filter information is also available for lazy loading implementation.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sort</td>
|
||||
<td>event.originalEvent: Browser event. <br />
|
||||
event.sortField: Field to sort against. <br />
|
||||
event.sortOrder: Sort order as integer. <br />
|
||||
event.multiSortMeta: MultiSort metadata.</td>
|
||||
<td>Callback to invoke on sort.</td>
|
||||
<td>event.page: New page number <br/>
|
||||
event.first: Index of first record <br/>
|
||||
event.rows: Number of rows to display in new page <br/>
|
||||
event.pageCount: Total number of pages <br />
|
||||
event.sortField: Field to sort against <br />
|
||||
event.sortOrder: Sort order as integer <br />
|
||||
event.multiSortMeta: MultiSort metadata <br />
|
||||
event.filters: Collection of active filters <br />
|
||||
event.filteredValue: Filtered collection
|
||||
</td>
|
||||
<td>Callback to invoke on sort. Page and Filter information is also available for lazy loading implementation.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>filter</td>
|
||||
<td>event.filters: Collection of active filters. <br />
|
||||
event.filteredValue: Filtered collection.</td>
|
||||
<td>Callback to invoke on filtering.</td>
|
||||
<td>event.page: New page number <br/>
|
||||
event.first: Index of first record <br/>
|
||||
event.rows: Number of rows to display in new page <br/>
|
||||
event.pageCount: Total number of pages <br />
|
||||
event.sortField: Field to sort against <br />
|
||||
event.sortOrder: Sort order as integer <br />
|
||||
event.multiSortMeta: MultiSort metadata <br />
|
||||
event.filters: Collection of active filters <br />
|
||||
event.filteredValue: Filtered collection
|
||||
</td>
|
||||
<td>Callback to invoke on filtering. Page and Sort information is also available for lazy loading implementation.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>row-click</td>
|
||||
|
|
Loading…
Reference in New Issue