Skip to content

Commit b670ea5

Browse files
authored
Merge pull request #193 from Avanade/1236-repo-list-pagination-dev
fix: List
2 parents 1d7ffc9 + 6973e55 commit b670ea5

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/goapp/public/components/list.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ const list = ({
4444
this.state.showStart = this.state.items.length > 0 ? ((this.state.page * this.state.filter) + 1) : 0;
4545
this.state.showEnd = (this.state.page * this.state.filter) + this.state.items.length;
4646
},
47+
async reload(){
48+
this.state.page = 0;
49+
this.state.total = 0;
50+
this.load();
51+
},
4752
//EVENT HANDLERS
4853
onChangeFilterHandler(e){
4954
this.state.page = 0,

src/goapp/templates/myapprovals.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<select @change="(e) => {
3434
state.other.requestType = requestTypes.find((obj) => { return e.target.value == obj.name})
3535
state.other.organization = 'All'
36-
load()
36+
reload()
3737
}"
3838
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
3939
<template x-for="item in requestTypes" :key="item.id">
@@ -47,7 +47,7 @@
4747
<div class="content-start">
4848
<label for="filter" class="block text-sm font-medium text-gray-700">Filter by Organization</label>
4949
<select @change="(e) => {
50-
load()
50+
reload()
5151
}"
5252
x-model="state.other.organization"
5353
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
@@ -82,7 +82,7 @@
8282
<div class="content-start">
8383
<label for="filter" class="block text-sm font-medium text-gray-700">Filter by Response</label>
8484
<select @change="() => {
85-
load()
85+
reload()
8686
}"
8787
x-model="state.other.responseType" id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
8888
<option>All</option>
@@ -97,7 +97,7 @@
9797
<select @change="(e) => {
9898
state.other.requestType = requestTypes.find((obj) => { return e.target.value == obj.name})
9999
state.other.organization = 'All'
100-
load()
100+
reload()
101101
}"
102102
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
103103
<template x-for="item in requestTypes" :key="item.id">
@@ -112,7 +112,7 @@
112112
<label for="filter" class="block text-sm font-medium text-gray-700">Filter by Organization</label>
113113
<select @change="(e) => {
114114
state.other.organization = e.target.value
115-
load()
115+
reload()
116116
}"
117117
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
118118
<template x-for="item in organizations">
@@ -392,7 +392,7 @@
392392
const offset = filter * page;
393393
search = encodeURIComponent(search)
394394
requestTypeParam = requestType == '' ? '' : '&requestType=' + requestType
395-
organizationParam = organization == 'All' ? '' : '&organization=' + organization
395+
organizationParam = organization.toLowerCase() == 'all' ? '' : '&organization=' + organization
396396
const res = await fetch(`/api/items/type/${type}/status/${status}?filter=${filter}&offset=${offset}&search=${search}${requestTypeParam}${organizationParam}`)
397397
const data = await res.json()
398398
return data

src/goapp/templates/myrequests.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<select @change="(e) => {
2222
state.other.requestType = requestTypes.find((obj) => { return e.target.value == obj.name})
2323
state.other.organization = 'All'
24-
load()
24+
reload()
2525
}"
2626
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
2727
<template x-for="item in requestTypes" :key="item.id">
@@ -35,7 +35,7 @@
3535
<div class="content-start">
3636
<label for="filter" class="block text-sm font-medium text-gray-700">Filter by Organization</label>
3737
<select @change="(e) => {
38-
load()
38+
reload()
3939
}"
4040
x-model="state.other.organization"
4141
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
@@ -70,7 +70,7 @@
7070
<div class="content-start">
7171
<label for="filter" class="block text-sm font-medium text-gray-700">Filter by Response</label>
7272
<select @change="() => {
73-
load()
73+
reload()
7474
}"
7575
x-model="state.other.responseType" id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
7676
<option>All</option>
@@ -85,7 +85,7 @@
8585
<select @change="(e) => {
8686
state.other.requestType = requestTypes.find((obj) => { return e.target.value == obj.name})
8787
state.other.organization = 'All'
88-
load()
88+
reload()
8989
}"
9090
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
9191
<template x-for="item in requestTypes" :key="item.id">
@@ -99,7 +99,7 @@
9999
<div class="content-start">
100100
<label for="filter" class="block text-sm font-medium text-gray-700">Filter by Organization</label>
101101
<select @change="(e) => {
102-
load()
102+
reload()
103103
}"
104104
x-model="state.other.organization"
105105
id="reponseType" name="responseType" class="block mt-1 pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
@@ -321,7 +321,7 @@
321321
const offset = filter * page;
322322
search = encodeURIComponent(search)
323323
requestTypeParam = requestType == '' ? '' : '&requestType=' + requestType
324-
organizationParam = organization == 'All' ? '' : '&organization=' + organization
324+
organizationParam = organization.toLowerCase() == 'all' ? '' : '&organization=' + organization
325325
const res = await fetch(`/api/items/type/${type}/status/${status}?filter=${filter}&offset=${offset}&search=${search}${requestTypeParam}${organizationParam}`)
326326
const data = await res.json()
327327
return data

0 commit comments

Comments
 (0)