Following your advice, i've replicated the class CachingDataSource (from Grid class) inside my mixin, and created an instance of it using the BindParameter GridDataSource.
@BindParameter private GridDataSource source; @OnEvent(value = EXPORT_EVENT) public StreamResponse export() { CachingDataSource cache = new CachingDataSource(source); int availableRows = cache.getAvailableRows(); cache.prepare(0, availableRows, Collections.emptyList()); BeanModel gridDataModel = grid.getDataModel(); (...) This way it works. It's still quite odd : the grid.getDataModel() call triggers the constructor of my GridDataSource. I can see in the debugger that inside the "grid" field, there is a "source" field defined and not null. But when I call the getSource() method, I get a null value, because this getter returns the field "cachingSource" of the grid which is null. This field seems to be initialized on the setupRender phase, which is obviously not executed in my case (an event handler). The Grid#setupRender method is package private, so I cannot call it to fix that (or may I, dispatching an event to the grid ?) Thanks. 2015-05-20 8:44 GMT+02:00 Nicolas Bouillon <nico...@bouillon.net>: > Thank you for your response. > > But grid.getDataSource() returns null. I guess it's because I'm in a event > handler method (grid.getDataSource() is not null in the AfterRenderTemplate > method). > > > > 2015-05-15 10:49 GMT+02:00 Lance Java <lance.j...@googlemail.com>: > >> I'm not entirely sure the problem but it's likely caused by @BindParameter >> which is likely invoking the binding each access. >> >> Try >> >> @InjectContainer Grid grid; >> >> And grid.getDataSource(). >> >> This will give you an instance of CachingDataSource which should have the >> lazy behaviour you want. >> > >