PDA

View Full Version : Communicate Extjs



saadkhan
27 Feb 2010, 7:21 AM
Hello,
I have made flex application (google map) which I want to embed to my same aspx page as Extjs script is running. I have a script file named Core.js that is included to Index.aspx page which renders whole page:



var routeStore;
function RecieveRouteXML(str) {
routeStore.proxy.data = StringToXml(str);
routeStore.load();
}

function StringToXml(str)
{
var doc;
if (window.ActiveXObject)
{
var doc = new ActiveXObject("Microsoft.XMLDOM");
doc.async = "false";
doc.loadXML(str);
return doc;
}
else
{
var doc = new DOMParser().parseFromString(str,"text/xml");
return doc;
}
}


Ext.onReady(function() {
routeStore = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(''),
reader: new Ext.data.XmlReader(
{
record: 'Point'
},
[
{name: 'Location', mapping: '@Location'},
{name: 'Speed', mapping: '@Speed'},
{name: 'DateAndTime', mapping: '@DateAndTime'},
{name: 'Latitude', mapping: '@Latitude'},
{name: 'Longitude', mapping: '@Longitude'}
])
});

var routeGrid = new Ext.grid.GridPanel({
title: 'Route',
store: routeStore,
hideHeaders: true,
columns:
[
{id: 'location', header: "Location", dataIndex: 'Location', renderer: function(value,p,r){ return String.format("<b>{0}</b><br />{1}<br />{2}<br />{3}, {4}", value, r.data['Speed'], r.data['DateAndTime'], r.data['Latitude'], r.data['Longitude']); }}
],
autoExpandColumn: 'location',
viewConfig:{ forceFit: true }
});
}


Function 'RecieveRouteXML' is receiving data (xml) from Flex app but it finds routeStore to be 'undefined', however page used to already been rendered. I have checked that this object is well defined and use to load fine when I manually calls this function by any means (like on button click event).....
I have checked that this function is called by flex and data receives!!!