Fixed #282 - TreeTable should pass more information on page-sort-filter events
parent
965dffa968
commit
fe9f51d903
|
@ -354,9 +354,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);
|
||||
},
|
||||
resetPage() {
|
||||
this.d_first = 0;
|
||||
|
@ -457,12 +461,7 @@ export default {
|
|||
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));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -602,10 +601,9 @@ export default {
|
|||
valueChanged = valueChanged || !localMatch || globalMatch;
|
||||
}
|
||||
|
||||
this.$emit('filter', {
|
||||
filters: this.filters,
|
||||
filteredValue: filteredNodes
|
||||
});
|
||||
let filterEvent = this.createLazyLoadEvent(event);
|
||||
filterEvent.filteredValue = filteredNodes;
|
||||
this.$emit('filter', filterEvent);
|
||||
|
||||
return valueChanged ? filteredNodes : value;
|
||||
},
|
||||
|
@ -648,6 +646,28 @@ export default {
|
|||
isNodeLeaf(node) {
|
||||
return node.leaf === false ? false : !(node.children && node.children.length);
|
||||
},
|
||||
createLazyLoadEvent(event) {
|
||||
let filterMatchModes;
|
||||
if (this.hasFilters) {
|
||||
filterMatchModes = {};
|
||||
this.columns.forEach(col => {
|
||||
if (col.field) {
|
||||
filterMatchModes[col.field] = col.filterMatchMode;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
originalEvent: event,
|
||||
first: this.d_first,
|
||||
rows: this.d_rows,
|
||||
sortField: this.d_sortField,
|
||||
sortOrder: this.d_sortOrder,
|
||||
multiSortMeta: this.d_multiSortMeta,
|
||||
filters: this.filters,
|
||||
filterMatchModes: filterMatchModes
|
||||
};
|
||||
},
|
||||
onColumnResizeStart(event) {
|
||||
let containerLeft = DomHandler.getOffset(this.$el).left;
|
||||
this.resizeColumnElement = event.target.parentElement;
|
||||
|
|
|
@ -1440,26 +1440,45 @@ export default {
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>page</td>
|
||||
<td>event.page: New page number <br/>
|
||||
<td>event.originalEvent: Browser event <br >
|
||||
event.page: New page number <br/>
|
||||
event.pageCount: Total page count <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.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.filterMatchModes: Match modes per field
|
||||
</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.originalEvent: Browser event <br >
|
||||
event.first: Index of first record <br/>
|
||||
event.rows: Number of rows to display in new page <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.filterMatchModes: Match modes per field
|
||||
</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.originalEvent: Browser event <br >
|
||||
event.first: Index of first record <br/>
|
||||
event.rows: Number of rows to display in new page <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 <br />
|
||||
event.filterMatchModes: Match modes per field
|
||||
</td>
|
||||
<td>Event to emit after filtering, not triggered in lazy mode.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>node-select</td>
|
||||
|
|
Loading…
Reference in New Issue