This commit is contained in:
2020-09-01 17:22:43 +00:00
parent a592fec7bc
commit 4b3bd3aa07
5 changed files with 44 additions and 34 deletions

View File

@@ -456,27 +456,26 @@ export default {
refresh() {
this.getDataFromApi();
},
getRowIds() {
getDataTableSourceOptions() {
let vm = this;
//called when parent form needs the selected id's or the list view options needed to rehydrate the entire list of id's in the same order and filter
//i.e. for reporting, bulk operations etc
let selectedRowIds = [];
//get selected row id's if there are selections else get all row id's
//called into from parent for things like reporting or bulk ops
//selected or records both are arrays with an id property that contains the row id conveniently for this method
if (this.selected.length > 0) {
if (vm.selected.length > 0) {
//return row id's of selected items only
return this.selected.map(z => {
selectedRowIds = vm.selected.map(z => {
return z.id;
});
}
//whups, records is only the visible paged amount, not all, back to the drawing board for this one but the above is fine
if (this.records.length > 0) {
//return row id's of all items
return this.records.map(z => {
return z.id;
});
}
//no data, just return an empty array
return [];
// console.log("records:", this.records);
// console.log("selected:", this.selected);
return {
selectedRowIds: selectedRowIds,
dataListKey: vm.dataListKey,
listView: untokenizeListView(vm.listView)
};
},
handleSelectChange() {
//due to making own template for items need to handle singleselect which only affects if select all checkbox at top is visible when making own item template