View Full Version : How to call a grid view from MessageBox?

19 Oct 2009, 9:10 AM
I have a running grid view and a demo Message Box from the Example site.
My grid loads data through json from mysql database - all fine.

My Messagebox:

<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript" src="./a.js"></script>

msg: 'Loading your Data, please wait...',
progressText: 'Saving...',
waitConfig: {interval:200},
// icon:'ext-mb-download', //custom class in msg-box.html
animEl: 'mb7'
//Ext.example.msg('Done', 'Your fake data was saved!');
}, 2000);


<div id="Aufgabe" ></div>

I want to call a.js - with is my gridview - and dont want to use fake time.
So i want to call a.js here:
.... Ext.MessageBox.hide();

Is there a solution for that problem ;) ?

Mike Robinson
19 Oct 2009, 11:18 AM
Take a very long, relaxed, hard look at Saki's "msgbus plugin" on this page (http://examples.extjs.eu/?ex=msgbus).

(Then, spend approximately the next two weeks poring over everything else on that site...) B)

This is probably the single most useful plugin I have found yet, in terms of overall application structure. The idea is that parts of your application ... anywhere ... can "subscribe to" events managed by this plugin. A regular-expression is used to specify exactly which events you are interested in.

Other parts of the app (such as your message-box) "publish" these events whenever something interesting happens, and all of the subscribers are duly informed. Subscribers do not have to care where publishers are, and vice-versa.

I have actually built support for this plugin into the application base-classes that we're going to be using company-wide, so that any form, panel, or window can specify "msgbus_subscriptions" either within its initial config or within initComponent(). The plugin is simply registered automagically everywhere because it's so darned useful.

19 Oct 2009, 12:24 PM
On your grids data store, setup a handler for the 'load' event. Inside that handler, you can call Ext.MessageBox.hide();

For example:

myStore.on('load', function(){

or in the config object for your data store:

new Ext.data.JsonStore({
listeners: {
'load': function(){

20 Oct 2009, 12:53 AM
Thanks Shea for your help an the code you attached.
Also thanks Mike for your tips and the link to the plugin, i will check it out!

I think now i can solve this problem - thanks!!!