Answers.Body: <p>If the page is rendered from a template that extends <code>_layouts/elementindex</code>, then the Element Index class instance is available at <code>Craft.elementIndex</code>. So all you’d need to do is include this in the settings object when creating your Modal instance:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>onHide: function() {
      Craft.elementIndex.updateElements();
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-05T11:39:03.743Z
Answers.LastActivityDate: 2016-04-05T11:39:03.743Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>Is it possible to refresh an element's list when closing a modal? I have a modal ready with:</p>
  
  <pre><code>onHide : function(){
      //but all what I tried doesn't work here
  
      //1: This will do the trick, but there is some bug with "Double-instantiating a select on an element" then the check box for the actions appear multiple times.
      Craft.elementIndex = Craft.createElementIndex('Plugin_ElementType', $('#main'), {
          context:        'index',
          storageKey:     'elementindex.Plugin_ElemenetType'
      });
  
      //2 I was searching for some global function as updateElements
      something like this: Craft.cp.updateElements()
      or: Craft.Plugin_ElementType.updateElements(); but no success
  
  }
  </code></pre>
  
  <p>I need this because in that modal I change, delete data from my elements so I have to update the list, if is possible without to reload the page of course. Thank you in advance!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-20T12:22:39.967Z
Comments.Text: What did you try already? A reference to updateElements should work, as long as you're using the right instance of it.
Comments.UserDisplayName: Bob Olde Hampsink
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-26T12:44:31.297Z
Comments.Text: I updated my question with What I tested.
Comments.UserDisplayName: Alex
Tags: <elementtype><javascript><updating>
Title: How to trigger updateElements when hide modal?
ThreadText: # How to trigger updateElements when hide modal?
  
  (Asked by: username_0 on 2015-06-19)
  
  Is it possible to refresh an element's list when closing a modal? I have a modal ready with:
  
  ```
  onHide : function(){
      //but all what I tried doesn't work here
  
      //1: This will do the trick, but there is some bug with "Double-instantiating a select on an element" then the check box for the actions appear multiple times.
      Craft.elementIndex = Craft.createElementIndex('Plugin_ElementType', $('#main'), {
          context:        'index',
          storageKey:     'elementindex.Plugin_ElemenetType'
      });
  
      //2 I was searching for some global function as updateElements
      something like this: Craft.cp.updateElements()
      or: Craft.Plugin_ElementType.updateElements(); but no success
  
  }
  
  ```
  
  I need this because in that modal I change, delete data from my elements so I have to update the list, if is possible without to reload the page of course. Thank you in advance!
  
  **Tags:** elementtype, javascript, updating
  
  > **Comments:**
  > **username_1**: What did you try already? A reference to updateElements should work, as long as you're using the right instance of it.  
  > **username_0**: I updated my question with What I tested.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-04-05. Score: 3
  
  If the page is rendered from a template that extends `_layouts/elementindex`, then the Element Index class instance is available at `Craft.elementIndex`. So all you’d need to do is include this in the settings object when creating your Modal instance:
  
  ```javascript
  onHide: function() {
      Craft.elementIndex.updateElements();
  }
  
  ```
  
  
  ---
  
  