Skip to content

Commit

Permalink
Improved: support to maintain the previous ordering and selected fiel…
Browse files Browse the repository at this point in the history
…ds after selecting all fields(#269)
  • Loading branch information
ymaheshwari1 committed Sep 26, 2023
1 parent 78bf008 commit 80040b1
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/views/DownloadPackedOrders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@
<ion-label>{{ fields[field] ? fields[field].label : field }}</ion-label>
</ion-item>
</ion-list>

<ion-list>
<ion-item :key="key" v-for="(field, key) in customFields">
<ion-label>{{ key }}</ion-label>
<ion-label slot="end">{{ field.value }}</ion-label>
<ion-button slot="end" fill="clear" @click="removeCustomField(key)">
<ion-icon :icon="trashOutline" />
</ion-button>
</ion-item>
</ion-list>
</main>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
Expand Down Expand Up @@ -256,8 +246,24 @@ export default defineComponent({
return alert.present();
},
selectAll() {
this.selectedData = JSON.parse(JSON.stringify(this.fieldMapping))
this.selectedFieldMappings = JSON.parse(JSON.stringify(this.fieldMapping))
const fields = JSON.parse(JSON.stringify(this.fieldMapping))
const unselectedFields = Object.keys(fields).reduce((unselectedFields: any, field) => {
if(!this.selectedFieldMappings[field]) {
unselectedFields[field] = fields[field]
}
return unselectedFields
}, {})
this.selectedData = {
...this.selectedFieldMappings,
...unselectedFields
}
this.selectedFieldMappings = {
...this.selectedFieldMappings,
...unselectedFields
}
},
async addFieldMapping() {
let mappings: any = {};
Expand Down

0 comments on commit 80040b1

Please sign in to comment.