Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table): fix page-change event sending old value #842

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions packages/docs/components/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ title: Table
| sortIcon | Sets the header sorting icon | string | - | <div><small>From <b>config</b>:</small></div><code style='white-space: nowrap; padding: 0;'>table: {<br>&nbsp;&nbsp;sortIcon: "arrow-up"<br>}</code> |
| sortIconSize | Sets the size of the sorting icon | string | `small`, `medium`, `large` | <div><small>From <b>config</b>:</small></div><code style='white-space: nowrap; padding: 0;'>table: {<br>&nbsp;&nbsp;sortIconSize: "small"<br>}</code> |
| stickyCheckbox | Make the checkbox column sticky when checkable | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| stickyHeader | Show a sticky table header | boolean | - | |
| stickyHeader | Show a sticky table header | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| striped | Whether table is striped | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| total | Total number of table data if backend-pagination is enabled | number | - | <code style='white-space: nowrap; padding: 0;'>0</code> |

Expand Down Expand Up @@ -163,24 +163,24 @@ title: Table

### Props

| Prop name | Description | Type | Values | Default |
| ---------------- | ---------------------------------------------------------------- | --------------------------------------------------- | --------------------------- | ----------------------------------------------------------- |
| customSearch | Define a custom funtion for the filter search | (row: unknown, filter: string) =&gt; boolean | - | |
| customSort | Define a custom sort function | (a: Column, b: Column, isAsc: boolean) =&gt; number | - | |
| field | Define an object property key if data is an object | string | - | |
| headerSelectable | Make header selectable | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| label | Define the column label | string | - | |
| meta | Add addtional meta information for the column for custom purpose | string\|number\|boolean\|func\|object\|array | - | |
| numeric | Define column value as number | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| position | Position of the column content | string | `left`, `centered`, `right` | |
| searchable | Enable an additional searchbar below the column header | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| sortable | Enable column sortability | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| sticky | Whether the column is sticky or not | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| subheading | Define a column sub heading | string | - | |
| tdAttrs | Adds native attributes to td | (row: unknown, column: Column) =&gt; object | - | Default function (see source code) |
| thAttrs | Adds native attributes to th | (column: Column) =&gt; object | - | Default function (see source code) |
| visible | Define whether the column is visible or not | boolean | - | <code style='white-space: nowrap; padding: 0;'>true</code> |
| width | Column fixed width | number\|string | - | |
| Prop name | Description | Type | Values | Default |
| ---------------- | ---------------------------------------------------------------- | ----------------------------------------------------- | --------------------------- | ----------------------------------------------------------- |
| customSearch | Define a custom funtion for the filter search | (row: unknown, filter: string) =&gt; boolean | - | |
| customSort | Define a custom sort function | (a: unknown, b: unknown, isAsc: boolean) =&gt; number | - | |
| field | Define an object property key if data is an object | string | - | |
| headerSelectable | Make header selectable | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| label | Define the column label | string | - | |
| meta | Add addtional meta information for the column for custom purpose | string\|number\|boolean\|func\|object\|array | - | |
| numeric | Define column value as number | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| position | Position of the column content | string | `left`, `centered`, `right` | |
| searchable | Enable an additional searchbar below the column header | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| sortable | Enable column sortability | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| sticky | Whether the column is sticky or not | boolean | - | <code style='white-space: nowrap; padding: 0;'>false</code> |
| subheading | Define a column sub heading | string | - | |
| tdAttrs | Adds native attributes to td | (row: unknown, column: Column) =&gt; object | - | Default function (see source code) |
| thAttrs | Adds native attributes to th | (column: Column) =&gt; object | - | Default function (see source code) |
| visible | Define whether the column is visible or not | boolean | - | <code style='white-space: nowrap; padding: 0;'>true</code> |
| width | Column fixed width | number\|string | - | |

### Slots

Expand Down
5 changes: 3 additions & 2 deletions packages/oruga/src/components/table/TablePagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@

/** Paginator change listener. */
function pageChanged(page: number): void {
currentPage.value = page > 0 ? page : 1;
emits("change", currentPage.value);
const newPage = page > 0 ? page : 1;
currentPage.value = newPage;
emits("change", newPage);

Check warning on line 44 in packages/oruga/src/components/table/TablePagination.vue

View check run for this annotation

Codecov / codecov/patch

packages/oruga/src/components/table/TablePagination.vue#L43-L44

Added lines #L43 - L44 were not covered by tests
}
</script>

Expand Down