PDA

View Full Version : Most unobtrusive way to communicate with ext...



EXTOmega
8 Oct 2010, 4:51 AM
I have a server side framework that I'd like to use to "initialize" some ext-js based components I've created. I was wondering if anyone had any suggestions as to how I might go about doing this as unobtrusively as possible.

The best example I can give in terms of what's going on here is that I have my pages, and when they're generated, the server is going to trigger certain UI widgets to appear along with the page.

So far I've been prototyping these as very simple statement blocks injected into the document:


<script type="text/javascript">
myCustomizedEXT.getInstance().addLink("Home", "/");
myCustomizedEXT.getInstance().addLink("Administration", "/Admin");
</script>

Is there a prettier way of getting this done, or is what I've got above pretty much what most people are doing to have a server signal the client side of various things that need to be done?

Condor
8 Oct 2010, 5:01 AM
If you don't want to use an extra request then this is probably the best way to do this.

ps. For links you could also have the server add ths links to the HTML markup and in Ext.onReady read the links from the markup and add them to your own app.
This has the advantage that the links are still visible, even if javascript is disabled.