Skip to content

Commit fa3c75a

Browse files
authored
Merge pull request #380 from devforth/AdminForth/876
docs: update docs for the afcl table
2 parents 6515340 + 607f015 commit fa3c75a

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

adminforth/documentation/docs/tutorial/03-Customization/15-afcl.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,49 @@ async function loadPageData(data) {
968968
//diff-add
969969
:data="loadPageData"
970970

971-
:pageSize="3"> </Table>
971+
:pageSize="3">
972+
</Table>
972973
```
973974
> 👆 The page size is used as the limit for pagination.
974975
976+
### Table loading states
977+
978+
For tables where you load data externally and pass them to `data` prop as array (including case with front-end pagination) you might want to show skeleton loaders in table externaly using `isLoading` props.
979+
980+
For tables with server-side paganation which use async function in data prop you can listen for `@update:tableLoading` to get table internal loading state, in other words this event will let you know when server side function started and finished execution, so you might use it e.g. to disable some external filter buttons and so on.
981+
982+
<div class="split-screen">
983+
984+
```ts
985+
import { Table, Button } from "@/afcl"
986+
const isTableLoading = ref(false);
987+
const tableState = ref("loading");
988+
989+
...
990+
991+
<Table
992+
:columns="[
993+
{ label: 'Name', fieldName: 'name' },
994+
{ label: 'Age', fieldName: 'age' },
995+
{ label: 'Country', fieldName: 'country' },
996+
]"
997+
:data="loadPageData"
998+
//diff-add
999+
:isLoading="isTableLoading"
1000+
:pageSize="3"
1001+
//diff-add
1002+
@update:tableLoading="(loading) => loading === true ? tableState = 'loading' : tableState = 'loaded'"
1003+
>
1004+
</Table>
1005+
1006+
<p> Table state: {{ tableState }} </p>
1007+
1008+
<Button @click="isTableLoading.value=!isTableLoading.value"> Toggle loading state</Button>
1009+
```
1010+
![AFCL Table](TableLoading.png)
1011+
1012+
</div>
1013+
9751014
## ProgressBar
9761015

9771016
<div class="split-screen" >
29.2 KB
Loading

0 commit comments

Comments
 (0)