title: How to update Vaadin Grid after push?
body: <p>I'm trying to update a grid in Vaadin after a change has been made to the grid from a different UI instance.</p>
  
  <p>To elaborate, I have two different UI instances, UI1 and UI2 (tabs from two different browsers). These UI instances contain a view which contains a grid consisted of Contact objects that have various properties such as name, age, gender...</p>
  
  <p>I add a Contact to the grid from UI1 and I want UI2 to see the updated grid instantly without having to refresh.</p>
  
  <p>To accomplish that, I know I have to use Vaadin Push which I already set up using a Broadcaster class. I have a <code>receiveBroadcast()</code> method in my UI class which will update the UI whenever a View class sends a broadcast to UIs using <code>broadcast()</code> method. Part of my UI class looks like this:</p>
  
  <pre><code>@Title("Contact Book")
  @Theme("reindeer")
  @Push
  public class UserInterface extends UI implements BroadcastListener{    
  
      private Navigator navigator;
  
      @Override
      protected void init(VaadinRequest request){
          navigator = new Navigator(this, this);
          navigator.addView(ContactBookView.NAME, new ContactBookView());
  
          Broadcaster.register(this);
      }
      @Override
      public void detach(){
          Broadcaster.unregister(this);
          super.detach();
      }
  
      @Override
      public void receiveBroadcast(Grid grid) {
          access(()-&gt;{
  
              // update grid here
              Notification.show("Grid updated", Notification.Type.TRAY_NOTIFICATION);
          });
      }
  }
  </code></pre>
  
  <p>And my Broadcaster class is as the same in <a href="https://vaadin.com/book/-/page/advanced.push.html#advanced.push.pusharound" rel="nofollow">this link</a> (I just altered the methods a bit so I can pass the grid as a parameter)</p>
  
  <p>Then in my ContactBookView class I call <code>Broadcaster.broadcast(grid)</code> method after adding or changing an item, so that I can update the grid somehow in my UI class' <code>access()</code> method but nothing I tried seems to work. I know that push is working because I can see the "Grid updated" message in all UI instances when broadcast is received.</p>
  
  <p>I tried to remove the view and re-initialize</p>
  
  <pre><code>navigator.removeView(ContactBookView.NAME);
  navigator.addView(ContactBookView.NAME, new ContactBookView());
  </code></pre>
  
  <p>Tried to completely empty the grid and refill</p>
  
  <pre><code>grid.removeAllColumns();
  grid.setContainerDataSource(container);
  </code></pre>
  
  <p>Tried to force the grid to update itself using this ugly workaround</p>
  
  <pre><code>grid.setContainerDataSource(grid.getContainerDataSource());
  </code></pre>
  
  <p>Tried to execute a JavaScript query to force the UIs to sync</p>
  
  <pre><code>JavaScript.getCurrent().execute("javascript:vaadin.forceSync();");
  </code></pre>
  
  <p>But none of these worked. Maybe I'm doing something else wrong? FYI my Vaadin version is 7.5.0.</p>
  
  <p>I'd appreciate any kind of feedback or advice,</p>
  
  <p>Thanks.</p>