Skip to content

Commit

Permalink
fix(table): solve a table columns ordering problem (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek authored Jan 30, 2025
1 parent ce11b3e commit ccae595
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/oruga/src/components/table/TableColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const filters = {} as Record<string, string>;
</script>

<template>
<span data-oruga="table-column" :data-id="item.identifier">
<span data-oruga="table-column" :data-id="`table-${item.identifier}`">
{{ label }}

<!--
Expand Down
4 changes: 2 additions & 2 deletions packages/oruga/src/composables/useParentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export function useProviderParent<ItemData = unknown, ParentData = unknown>(
.map((item) => `[data-id="${key}-${item.identifier}"]`)
.join(",");

// query all child items
// query all child items in the order of the DOM appearance
const children = parent.querySelectorAll(ids);

// create a list of ids ordered after the elements in template
// create a list of ids ordered after the elements in DOM
const sortedIds = Array.from(children).map((el) =>
el.getAttribute("data-id")?.replace(`${key}-`, ""),
);
Expand Down

0 comments on commit ccae595

Please sign in to comment.