<ejs-grid
id="outlets-grid"
ref="outletGridRef"
:dataSource="
customersListRes.CustomerMaster && customersListRes.CustomerMaster.length > 0
? customersListRes.CustomerMaster
: []
"
:pageSettings="pageSettings"
:allowPaging="true"
v-on:actionBegin="gridActionBegin($event)"
v-on:actionComplete="gridActionComplete($event)"
:dataStateChange="dataStateChange"
>
<e-columns>
<e-column
field="AprovalStatus"
:headerText="$t('common.status')"
textAlign="Right"
width="90"
>e-column>
<e-column field="CustomerStatus" :headerText="$t('common.isactive')" width="120">e-column>
<e-column
field="CustomerCode"
:headerText="$t('outlet.outletcode')"
textAlign="Right"
format="C2"
width="90"
>e-column>
<e-column field="CustomerName" :headerText="$t('outlet.outletname')" textAlign="Right">e-column>
<e-column
field="OutletHierarchyName"
:headerText="$t('outlet.hierarchy')"
textAlign="Right"
>e-column>
<e-column
field="CategoryDescription1"
:headerText="updatedColumns('CategoryDescription1')"
textAlign="Right"
>e-column>
<e-column
field="CategoryDescription2"
:headerText="updatedColumns('CategoryDescription2')"
textAlign="Right"
>e-column>
<e-column
field="CustomerPrincipleCode"
:headerText="$t('outlet.customerprinciplecode')"
textAlign="Right"
>e-column>
<e-column
field="CustomerPrincipleCode"
:headerText="$t('outlet.contactperson')"
textAlign="Right"
>e-column>
<e-column
field="$t('common.contacts')"
:headerText="$t('common.contacts')"
textAlign="Right"
>e-column>
e-columns>
ejs-grid>
methods: {
async fetchCustomersList() {
this.isLoading = true
const client = api()
await client
.get('customer', {
params: this.customerListReqBody
})
.then(response => {
this.customersListRes = response.data
this.pageSettings.pageCount = response.data.total ? +response.data.total : 0
this.pageSettings.currentPage = response.data.page ? +response.data.page : 1
console.log(this.pageSettings)
this.isLoading = false
})
.catch(error => {
console.error(error)
this.isLoading = false
})
.finally(() => {
console.log('executing finally!')
})
},
onPageChange(params) {
console.log(params)
this.customerListReqBody.page = params.currentPage
this.fetchCustomersList()
},,
gridActionBegin(event) {
console.log(event)
if (event.requestType === 'paging') {
this.onPageChange(event)
}
},
gridActionComplete(event) {
console.log(event, 'complete')
if (event.requestType === 'paging') {
this.onPageChange(event)
}
},
dataStateChange(event) {
console.log(event, 'dataStateChange')
}
},
mounted() {
this.fetchCustomersList()
},