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

Datatable should emit the restored multiSortMeta on a reload #6325

Closed
Aspyryan opened this issue Sep 2, 2024 · 1 comment
Closed

Datatable should emit the restored multiSortMeta on a reload #6325

Aspyryan opened this issue Sep 2, 2024 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Aspyryan
Copy link

Aspyryan commented Sep 2, 2024

When sorting in a stateful grid, it stores it in localstorage, but on a reload of the page or component, this state get's re-added to the internal component value but not emitted by the multiSortMeta model state. This should be added one way or another.

if (restoredState.multiSortMeta) {
this.d_multiSortMeta = restoredState.multiSortMeta;
}

We use a temp fix like this:

	// Get multiSortMeta from localstorage here since primevue issue #6325
	const localState = localStorage.getItem(stateKey.value!);
	if (localState) {
		const stateObject = JSON.parse(localState);
		if (stateObject.multiSortMeta.length > 0) {
			multiSortMeta.value = stateObject.multiSortMeta;
		}
	}
@EwenDC
Copy link
Contributor

EwenDC commented Mar 11, 2025

Also applies to the first, rows, sortField, and sortOrder props

@tugcekucukoglu tugcekucukoglu added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Mar 17, 2025
@tugcekucukoglu tugcekucukoglu added this to the 4.3.3 milestone Mar 17, 2025
@tugcekucukoglu tugcekucukoglu self-assigned this Mar 17, 2025
@github-project-automation github-project-automation bot moved this to Review in PrimeVue Mar 17, 2025
@github-project-automation github-project-automation bot moved this from Review to Done in PrimeVue Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
Status: Done
Development

No branches or pull requests

3 participants