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

get current sort #689

Open
Macro-Jackson opened this issue May 25, 2020 · 1 comment
Open

get current sort #689

Macro-Jackson opened this issue May 25, 2020 · 1 comment

Comments

@Macro-Jackson
Copy link

Can I get the current sorting of the table somehow?
I can't find any documentation about this...

@Macro-Jackson
Copy link
Author

Macro-Jackson commented May 25, 2020

I can't find a "List.getSort()" or a "List.getOrder()".... Would be nice to have this implemented.

Solved (for now) by a workaround:

storeList.on('updated', function (event) {
	storeHeader = document.getElementById('listHeader');
	storeSelectSort = document.getElementById('selectSort');
	for (node in storeHeader.childNodes) {
		if (storeHeader.childNodes[node].classList) {
			order = storeHeader.childNodes[node].classList[storeHeader.childNodes[node].classList.length - 1];
			if (order == 'asc' || order == 'desc') {
				dataSort = storeHeader.childNodes[node].classList[storeHeader.childNodes[node].classList.length - 1];
				dataOrder = storeHeader.childNodes[node].classList[1];
				break;
			}
		}
	}

	for (let option = 0; option < storeSelectSort.options.length; option++) {
		if (storeSelectSort.options[option].getAttribute('data-sort') == dataSort && storeSelectSort.options[option].getAttribute('value') == dataOrder) {
			storeSelectSort.selectedIndex = option;
			break;
		}
	}
});

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

No branches or pull requests

1 participant