PDA

View Full Version : Data carried over to another application



yvesm
3 Apr 2009, 11:12 AM
Hello All,

I'm having a bit of a hard time figuring out how to use the Ext event system to delegate info to another application that dies not use Ext (but uses JS). I sense I need to do a createCallback or createDelegate, but I have no idea where to start to figure that out.

What we have in mind is to send a JSON string to another application on click of a button in the Ext application. We have the JSON string from the Ext object and now we were thinking of travelling back to the originating application that triggers Ext with window.opener, activate (fire click event ?) some hidden control there and pass it the JSON string as a parameter. The handler function would be written in the destination (parent) application.

Are there examples of things like that ?

TIA,

Yves Moisan

Joe
3 Apr 2009, 6:34 PM
All a call back does really .. is call the function in your app. So you can just make a function in the window of your external app like this ...


window.helloThere = function(yourName){
alert('hello ' + yourName )
}


You mentioned opener, so here is an example of using that to communicate from your EstJS form back to your ExtJS form.


Ext.onReady(function() {

function helloWorld(){
window.opener.helloThere('Bob')
}
var myPanel = new Ext.Panel({
title: 'Dialog',
tbar: [{text: 'Hello', onClick: helloWorld }],
renderTo: document.body,
html: 'Say hello'
})


});

Then all the complex logic goes in the functions (both on the ExtJS form and your apps forms), hope that helps.

Cheers

yvesm
6 Apr 2009, 5:11 AM
[quote=Joe;312719]All a call back does really .. is call the function in your app. So you can just make a function in the window of your external app like this ...

hi Joe,

Thanx for your example. We did something similar to what you suggest in our first pass. The only difference is that we were calling window.opener directly. now, we were thinking more in terms of "how can we fire an event from our Ext app that our external application could react to if we were to make it listen to it ?"

The problem in that case is to pass an argument. We wanted to decouple ourselves from our external application i.e. we thought we could do with not knowing the function to call in the external app : just fire an event with a parameter and let whatever object in the external app react to it. Is that feasible ?

TIA,

Yves