11<template >
22 <b-row no-gutters >
33 <b-card-body :title =" title" >
4- <criterion-list-group class =" eglt-table-wrapper" >
4+ <div class =" eglt-table-wrapper" >
55 <div class =" filtering-ui-wrapper container-fluid" >
66 <div class =" row filtering-ui-content" >
77 <div class =" col filter-col-md" >
88 <div class =" label" >Search</div >
9- <input class =" col filter-col-md form-control" v-model =" filterString" />
9+ <input
10+ v-model =" filterString"
11+ class =" col filter-col-md form-control"
12+ debounce =" 500"
13+ />
1014 </div >
1115 </div >
1216 </div >
13- </criterion-list-group >
17+ </div >
1418 <div class =" text-right mt-2 mb-2" >
1519 <data-download
1620 :data =" geneInfo"
2630 :current-page =" currentPage"
2731 :filter =" filterString"
2832 small
33+ @filtered =" onFiltered"
2934 >
3035 <!-- Custom rendering for known special cases -->
3136 <template #cell (id)="data">
7378
7479 <b-pagination
7580 v-model =" currentPage"
76- :total-rows =" geneInfo.length "
81+ :total-rows =" totalRows "
7782 :per-page =" perPage"
7883 :aria-controls =" id"
7984 size =" sm"
@@ -103,13 +108,14 @@ export default Vue.component("TranslatorPredicateTable", {
103108 },
104109 data () {
105110 return {
106- id: this .geneSymbol + this .fields + this .title ,
111+ id: this .geneSymbol + this .field + this .title ,
107112 currentPage: 1 ,
108113 perPage: 10 ,
109114 rawGeneInfo: [],
110115 myFilter : (id ) => true ,
111116 context: null ,
112117 filterString: " " ,
118+ totalRows: 0 ,
113119 };
114120 },
115121 computed: {
@@ -119,25 +125,28 @@ export default Vue.component("TranslatorPredicateTable", {
119125 );
120126 },
121127 fields () {
122- return Array .from (
123- new Set (
124- this .geneInfo .reduce (
125- (acc , item ) => acc .concat (... Object .keys (item)),
126- []
128+ return (
129+ Array .from (
130+ new Set (
131+ this .geneInfo .reduce (
132+ (acc , item ) => acc .concat (... Object .keys (item)),
133+ []
134+ )
127135 )
128136 )
129- )
130- .sort ((a , b ) => {
131- const sortMap = { id: 0 , source: 1 };
132- if (a === " id" ) {
133- return - 1 ;
134- } else if (b === " id" ) {
135- return 1 ;
136- }
137- })
138- .filter (
139- (el ) => ! [" evidence" , " gocategory" , " category" ].includes (el)
140- );
137+ .sort ((a , b ) => {
138+ const sortMap = { id: 0 , source: 1 };
139+ if (a === " id" ) {
140+ return - 1 ;
141+ } else if (b === " id" ) {
142+ return 1 ;
143+ }
144+ })
145+ .filter (
146+ (el ) =>
147+ ! [" evidence" , " gocategory" , " category" ].includes (el)
148+ ) || []
149+ );
141150 },
142151 tableFields () {
143152 return this .fields .map ((key ) => ({
@@ -178,7 +187,7 @@ export default Vue.component("TranslatorPredicateTable", {
178187 },
179188 async created () {
180189 this .context = await fetch (
181- " https://raw.githubusercontent.com/biolink/biolink-model/master/context.jsonld"
190+ " https://raw.githubusercontent.com/biolink/biolink-model/master/project/jsonld/biolink_model. context.jsonld"
182191 )
183192 .then ((response ) => response .json ())
184193 .then ((json ) => json[" @context" ]);
@@ -247,6 +256,11 @@ export default Vue.component("TranslatorPredicateTable", {
247256 return cellValue;
248257 }
249258 },
259+ onFiltered (filteredItems ) {
260+ // Trigger pagination to update the number of buttons/pages due to filtering
261+ this .totalRows = filteredItems .length ;
262+ this .currentPage = 1 ;
263+ },
250264 },
251265});
252266 </script >
0 commit comments