File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 242242 :pageSize =" 3"
243243 >
244244 </Table >
245+ <div >
246+ Backend pagination ⬇️
247+ <Table
248+ :columns =" [
249+ { label: 'Name', fieldName: 'name' },
250+ { label: 'Age', fieldName: 'age' },
251+ { label: 'Country', fieldName: 'country' },
252+ ]"
253+ :data =" loadPageData"
254+
255+ :pageSize =" 3" >
256+ </Table >
257+ </div >
245258
246259 <div class =" w-full" >
247260 <p class =" text-sm font-semibold text-lightPrimary dark:text-darkPrimary mb-2" >TreeMapChart (value + delta)</p >
@@ -487,4 +500,18 @@ async function createJob() {
487500 }
488501}
489502
503+ async function loadPageData(data ) {
504+ const { offset, limit } = data ;
505+ // in real app do await callAdminForthApi or await fetch to get date, use offset and limit value to slice data
506+ await new Promise (resolve => setTimeout (resolve , 1000 )) // simulate network delay
507+ return {
508+ data: [
509+ { name: ' John' , age: offset , country: ' US' },
510+ { name: ' Rick' , age: offset + 1 , country: ' CA' },
511+ { name: ' Alice' , age: offset + 2 , country: ' BR' },
512+ ],
513+ total: 30 // should return total amount of records in database
514+ }
515+ }
516+
490517 </script >
You can’t perform that action at this time.
0 commit comments