Skip to content

Commit

Permalink
fix(table): fix page-change event sending old value (oruga-ui#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek committed Mar 9, 2024
1 parent f5dee3f commit 9cb8d5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
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 @@ const currentPage = usePropBinding("current", props, emits);
/** 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);
}
</script>

Expand Down

0 comments on commit 9cb8d5b

Please sign in to comment.