Skip to content

Instantly share code, notes, and snippets.

@brianteeman
Last active September 2, 2018 22:18
Show Gist options
  • Save brianteeman/82bb966db67b355aee24e5892ed3510a to your computer and use it in GitHub Desktop.
Save brianteeman/82bb966db67b355aee24e5892ed3510a to your computer and use it in GitHub Desktop.

For accessibility we need to add a caption to every table in the admin

For example

Articles

	<caption>Articles</caption>
		<thead>
		etc etc

But we also need to get the current sort setting and possibly filters (if set)

for Example

Articles

	<caption>Articles sorted by JGLOBAL_TITLE_ASC filtered by Category - Blog</caption>
		<thead>
		etc etc		

Currently we only have

$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn  = $this->escape($this->state->get('list.direction'));		

Which gives a.title asc

Where what we need is the JText used for "a.title ASC" in filter_articles.xml

Any ideas??

One option would be is that I can set an attribute in the th if it is selected and then some JS magic could use that

<th>
<a href="#" onclick="return false;" class="js-stools-column-order selected" data-order="a.title" data-direction="DESC" data-name="Title" selected="true">
</th>

psedo code if (selected === true) : $sort = data-name="Title" - data-direction="DESC"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment