This commit is contained in:
2020-01-31 01:15:27 +00:00
parent 2dee1dd9c6
commit 3167afa80e
2 changed files with 31 additions and 6 deletions

View File

@@ -47,7 +47,6 @@
:value="item" :value="item"
primary primary
hide-details hide-details
@change="handleSelect($event)"
></v-checkbox> ></v-checkbox>
</td> </td>
</template> </template>
@@ -136,17 +135,39 @@ export default {
}, },
deep: true deep: true
}, },
"$vuetify.breakpoint.xs": function(value) { selected: {
//for now, not going with my own mini mode but may revisit so keeping this for now handler(newValue, oldValue) {
// this.getDataFromApi(); if (newValue.length != oldValue.length) {
console.log("Selected changed, triggering handleSelectChange:");
this.handleSelectChange();
}
},
deep: true
} }
// ,
// selected: function(newValue, oldValue) {
// if (newValue != oldValue) {
// console.log("Selected changed, triggering handleSelectChange:");
// this.handleSelectChange();
// }
// }
// , //for now, not going with my own mini mode but may revisit so keeping this here but commented out for now
// "$vuetify.breakpoint.xs": function(value) {
// this.getDataFromApi();
// }
}, },
methods: { methods: {
handleSelect(selectedItem) { 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 //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
if (this.singleSelect) { if (this.singleSelect) {
this.selected.splice(0, this.selected.length - 1); this.selected.splice(0, this.selected.length - 1);
} }
//emit event to parent form of selected rows
//this.$emit("update:selected", this.selected);
//Note that this bubbles up all the columns of all the selected rows
//could be more efficient if it just sends the ID's instead:
this.$emit("update:selected", window.$gz._.map(this.selected, "id"));
}, },
btnClick(key, i) { btnClick(key, i) {
//translate key to actual object type from header data //translate key to actual object type from header data

View File

@@ -5,8 +5,9 @@
dataListKey="TestWidgetDataList" dataListKey="TestWidgetDataList"
:caption="getCaption()" :caption="getCaption()"
:dataFilterId="currentDataFilterId" :dataFilterId="currentDataFilterId"
:showSelect="false" :showSelect="true"
:singleSelect="false" :singleSelect="false"
v-on:update:selected="handleSelected"
> >
</gz-data-table> </gz-data-table>
</v-container> </v-container>
@@ -34,6 +35,9 @@ export default {
}; };
}, },
methods: { methods: {
handleSelected(selectedItems) {
console.log(selectedItems);
},
getCaption() { getCaption() {
return window.$gz.locale.get("WidgetList"); return window.$gz.locale.get("WidgetList");
} }