<pre><code>Craft.elementIndex.on('selectSource', function(){
     alert('changed the source');
});
</code></pre>
<p><code>Craft.elementIndex</code> contains the plugin for all index pages, that means all entries as well as users and categories. There is an <code>updateElements</code> event as well..</p>
<p>Here is a full list</p>
<blockquote>
<p>afterInit</p>
<p>selectSource</p>
<p>selectSite</p>
<p>updateElements</p>
<p>selectionChange</p>
<p>enableElements</p>
<p>disableElements</p>
<p>afterAction</p>
</blockquote>

CC BY-SA 3.0
2018-04-23T21:49:16.393Z
2018-04-23T22:15:00.823Z
2020-06-17T08:56:27.903Z
Robin Schambach
<p>When I am on the categories index (admin/categories), is there a Garnish event that fires when you select a different category group in the sidebar? I want to add some custom JS after the AJAX request completes and the elements have been added to the page.</p>

<categories><javascript><garnish>
Garnish event when changing category group
# Garnish event when changing category group

(Asked by: username_0 on 2018-04-23)

When I am on the categories index (admin/categories), is there a Garnish event that fires when you select a different category group in the sidebar? I want to add some custom JS after the AJAX request completes and the elements have been added to the page.

**Tags:** categories, javascript, garnish

---

## 1 answers

### Answer by username_1 on 2018-04-23. Score: 1 | Accepted answer

Craft.elementIndex.on('selectSource', function(){
     alert('changed the source');
});

Craft.elementIndex contains the plugin for all index pages, that means all entries as well as users and categories. There is an updateElements event as well..
Here is a full list

afterInit
selectSource
selectSite
updateElements
selectionChange
enableElements
disableElements
afterAction


---

