diff --git a/components/lib/datatable/BaseDataTable.vue b/components/lib/datatable/BaseDataTable.vue index cd6dfb56e..8bdf78646 100644 --- a/components/lib/datatable/BaseDataTable.vue +++ b/components/lib/datatable/BaseDataTable.vue @@ -250,6 +250,10 @@ export default { type: Boolean, default: false }, + highlightOnSelect: { + type: Boolean, + default: false + }, size: { type: String, default: null diff --git a/components/lib/datatable/style/DataTableStyle.js b/components/lib/datatable/style/DataTableStyle.js index 70666a6aa..d8a7baf91 100644 --- a/components/lib/datatable/style/DataTableStyle.js +++ b/components/lib/datatable/style/DataTableStyle.js @@ -360,7 +360,7 @@ const classes = { if (props.selection) { rowStyleClass.push({ - 'p-highlight': instance.isSelected + 'p-highlight': instance.isSelected && instance.$parentInstance.$parentInstance.highlightOnSelect }); } diff --git a/components/lib/multiselect/BaseMultiSelect.vue b/components/lib/multiselect/BaseMultiSelect.vue index 99b5b5f58..cb1495937 100644 --- a/components/lib/multiselect/BaseMultiSelect.vue +++ b/components/lib/multiselect/BaseMultiSelect.vue @@ -131,6 +131,10 @@ export default { type: Boolean, default: false }, + highlightOnSelect: { + type: Boolean, + default: false + }, filterMessage: { type: String, default: null diff --git a/components/lib/multiselect/style/MultiSelectStyle.js b/components/lib/multiselect/style/MultiSelectStyle.js index ea29d859c..dee9bab70 100644 --- a/components/lib/multiselect/style/MultiSelectStyle.js +++ b/components/lib/multiselect/style/MultiSelectStyle.js @@ -156,10 +156,10 @@ const classes = { wrapper: 'p-multiselect-items-wrapper', list: 'p-multiselect-items p-component', itemGroup: 'p-multiselect-item-group', - item: ({ instance, option, index, getItemOptions }) => [ + item: ({ instance, option, index, getItemOptions, props }) => [ 'p-multiselect-item', { - 'p-highlight': instance.isSelected(option), + 'p-highlight': instance.isSelected(option) && props.highlightOnSelect, 'p-focus': instance.focusedOptionIndex === instance.getOptionIndex(index, getItemOptions), 'p-disabled': instance.isOptionDisabled(option) } diff --git a/components/lib/tree/BaseTree.vue b/components/lib/tree/BaseTree.vue index d4990c80a..2eeb8585c 100644 --- a/components/lib/tree/BaseTree.vue +++ b/components/lib/tree/BaseTree.vue @@ -58,6 +58,10 @@ export default { type: String, default: undefined }, + highlightOnSelect: { + type: Boolean, + default: false + }, scrollHeight: { type: String, default: null diff --git a/components/lib/tree/style/TreeStyle.js b/components/lib/tree/style/TreeStyle.js index 59c52e31d..b2e0068bd 100644 --- a/components/lib/tree/style/TreeStyle.js +++ b/components/lib/tree/style/TreeStyle.js @@ -108,7 +108,7 @@ const classes = { instance.node.styleClass, { 'p-treenode-selectable': instance.selectable, - 'p-highlight': instance.checkboxMode ? instance.checked : instance.selected + 'p-highlight': instance.checkboxMode && instance.$parentInstance.highlightOnSelect ? instance.checked : instance.selected } ], toggler: 'p-tree-toggler p-link',