Skip to content
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
fix(datatable): make headercheckboxicon work again
  • Loading branch information
Aleksandr Chaplinskii committed Jul 22, 2025
commit d7ec16b1556e2f1c842cb9096885a8b93c0e264c
64 changes: 64 additions & 0 deletions packages/primevue/src/datatable/DataTable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,4 +1439,68 @@ describe('DataTable.vue', () => {
// contextmenu

// row styling
it('should render custom headercheckboxicon slot in Column', () => {
wrapper = mount(DataTable, {
global: {
plugins: [PrimeVue],
components: {
Column
}
},
props: {
value: smallData,
selection: null
},
slots: {
default: `
<Column selectionMode="multiple">
<template #headercheckboxicon>
<span class="custom-header-checkbox-icon">CustomIcon</span>
</template>
</Column>
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
`
}
});

const headerCheckboxIcon = wrapper.find('.custom-header-checkbox-icon');

expect(headerCheckboxIcon.exists()).toBe(true);
expect(headerCheckboxIcon.text()).toBe('CustomIcon');
});

it('should render custom rowcheckboxicon slot in Column', () => {
wrapper = mount(DataTable, {
global: {
plugins: [PrimeVue],
components: {
Column
}
},
props: {
value: smallData,
selection: null
},
slots: {
default: `
<Column selectionMode="multiple">
<template #rowcheckboxicon>
<span class="custom-row-checkbox-icon">CustomIcon</span>
</template>
</Column>
<Column field="code" header="Code"></Column>
<Column field="name" header="Name"></Column>
`
}
});

// custom-row-checkbox-icon should be rendered in each row, so 3 times
const rowCheckboxIcons = wrapper.findAll('.custom-row-checkbox-icon');

expect(rowCheckboxIcons.length).toBe(3);
expect(rowCheckboxIcons[0].text()).toBe('CustomIcon');
expect(rowCheckboxIcons[1].text()).toBe('CustomIcon');
expect(rowCheckboxIcons[2].text()).toBe('CustomIcon');
});
});
4 changes: 2 additions & 2 deletions packages/primevue/src/datatable/HeaderCheckbox.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<Checkbox :modelValue="checked" :binary="true" :disabled="disabled" :aria-label="headerCheckboxAriaLabel" @change="onChange" :unstyled="unstyled" :pt="getColumnPT('pcHeaderCheckbox')">
<!--<template #icon="slotProps">
<template #icon="slotProps">
<component v-if="headerCheckboxIconTemplate" :is="headerCheckboxIconTemplate" :checked="slotProps.checked" :class="slotProps.class" />
<CheckIcon v-else-if="!headerCheckboxIconTemplate && slotProps.checked" :class="slotProps.class" v-bind="getColumnPT('pcHeaderCheckbox')['icon']" />
</template>-->
</template>
</Checkbox>
</template>

Expand Down