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

feat: add expandedKeys, update emit event in TreeSelect #6501

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

KumJungMin
Copy link
Contributor

@KumJungMin KumJungMin commented Sep 30, 2024

Defect Fixes

description

  • TreeSelect can be considered an extended version of the Tree component.
  • However, unlike the Tree component, it does not provide the expandedKeys functionality.
  • This behavior seems to deviate from the intended design.
  • Therefore, I modified it so that the expandedKeys function works similarly to the Tree component. :)

Test

TreeSelect Test Sample Code
<template>
	<div>
    	<Button @click="expandedKeys = { 0: true }">change expandedKeys value</Button>
    	<p>expandedKeys: {{ expandedKeys }}</p>
    	<hr />
    	<TreeSelect 
			v-model="selectedValue" 
			:options="nodes" 
			selectionMode="checkbox" 
			:expandedKeys="expandedKeys" 
			display="chip" 
			placeholder="Select Item" 
			class="md:w-20rem w-full" 
			:removeable="true" 
			@update:expandedKeys="setExpandedKeys" 
		/>
	</div>
</template>

<script>
import { NodeService } from '/service/NodeService';

export default {
    data() {
        return {
            nodes: null,
            selectedValue: null,
            expandedKeys: null
        };
    },
    mounted() {
        NodeService.getTreeNodes().then((data) => (this.nodes = data));
    },
    methods: {
        setExpandedKeys(event) {
            this.expandedKeys = event;
        }
    }
};
</script>

result

2024-10-01.12.22.47.mov

Copy link

vercel bot commented Sep 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primevue ⬜️ Ignored (Inspect) Sep 30, 2024 3:16pm
primevue-v3 ⬜️ Ignored (Inspect) Sep 30, 2024 3:16pm

@KumJungMin KumJungMin marked this pull request as ready for review September 30, 2024 15:28
@tugcekucukoglu tugcekucukoglu merged commit 461652c into primefaces:master Oct 2, 2024
5 checks passed
@tugcekucukoglu
Copy link
Member

Thank you very much for your great support of Prime libraries.

We need to add something to this PR.

3e04e74

@AericN
Copy link

AericN commented Oct 2, 2024

Thank you for adding this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TreeSelect: expandedKeys not working
3 participants