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_first = event.first;
|
||||||
this.d_rows = event.rows;
|
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:first', this.d_first);
|
||||||
this.$emit('update:rows', this.d_rows);
|
this.$emit('update:rows', this.d_rows);
|
||||||
this.$emit('page', event);
|
this.$emit('page', pageEvent);
|
||||||
},
|
},
|
||||||
resetPage() {
|
resetPage() {
|
||||||
this.d_first = 0;
|
this.d_first = 0;
|
||||||
|
@ -457,12 +461,7 @@ export default {
|
||||||
this.$emit('update:multiSortMeta', this.d_multiSortMeta);
|
this.$emit('update:multiSortMeta', this.d_multiSortMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('sort', {
|
this.$emit('sort', this.createLazyLoadEvent(event));
|
||||||
originalEvent: event,
|
|
||||||
sortField: this.d_sortField,
|
|
||||||
sortOrder: this.d_sortOrder,
|
|
||||||
multiSortMeta: this.d_multiSortMeta
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -602,10 +601,9 @@ export default {
|
||||||
valueChanged = valueChanged || !localMatch || globalMatch;
|
valueChanged = valueChanged || !localMatch || globalMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('filter', {
|
let filterEvent = this.createLazyLoadEvent(event);
|
||||||
filters: this.filters,
|
filterEvent.filteredValue = filteredNodes;
|
||||||
filteredValue: filteredNodes
|
this.$emit('filter', filterEvent);
|
||||||
});
|
|
||||||
|
|
||||||
return valueChanged ? filteredNodes : value;
|
return valueChanged ? filteredNodes : value;
|
||||||
},
|
},
|
||||||
|
@ -648,6 +646,28 @@ export default {
|
||||||
isNodeLeaf(node) {
|
isNodeLeaf(node) {
|
||||||
return node.leaf === false ? false : !(node.children && node.children.length);
|
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) {
|
onColumnResizeStart(event) {
|
||||||
let containerLeft = DomHandler.getOffset(this.$el).left;
|
let containerLeft = DomHandler.getOffset(this.$el).left;
|
||||||
this.resizeColumnElement = event.target.parentElement;
|
this.resizeColumnElement = event.target.parentElement;
|
||||||
|
|
|
@ -1440,26 +1440,45 @@ export default {
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>page</td>
|
<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.first: Index of first record <br/>
|
||||||
event.rows: Number of rows to display in new page <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>
|
||||||
<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>
|
||||||
<tr>
|
<tr>
|
||||||
<td>sort</td>
|
<td>sort</td>
|
||||||
<td>event.originalEvent: Browser event. <br />
|
<td>event.originalEvent: Browser event <br >
|
||||||
event.sortField: Field to sort against. <br />
|
event.first: Index of first record <br/>
|
||||||
event.sortOrder: Sort order as integer. <br />
|
event.rows: Number of rows to display in new page <br/>
|
||||||
event.multiSortMeta: MultiSort metadata.</td>
|
event.sortField: Field to sort against <br />
|
||||||
<td>Callback to invoke on sort.</td>
|
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>
|
||||||
<tr>
|
<tr>
|
||||||
<td>filter</td>
|
<td>filter</td>
|
||||||
<td>event.filters: Collection of active filters. <br />
|
<td>event.originalEvent: Browser event <br >
|
||||||
event.filteredValue: Filtered collection.</td>
|
event.first: Index of first record <br/>
|
||||||
<td>Callback to invoke on filtering.</td>
|
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>
|
||||||
<tr>
|
<tr>
|
||||||
<td>node-select</td>
|
<td>node-select</td>
|
||||||
|
|
Loading…
Reference in New Issue