Results 1 to 6 of 6

Thread: Communicate Extjs

  1. #1

    Default Communicate Extjs

    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:

    Code:
    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!!!

    When I hosts flex app on my same .aspx page, it also throws Ext is undefined (but page renders and works fine)....

    Please help me on why is my 'routeStore' object finds to be undefined when flex calls this function????

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    First off, you don't need to use global variables like "var routeStore;" - you can access the store via Ext.StoreMgr if you provide it with a storeId:

    Code:
    function RecieveRouteXML(str) 
    {
      var ds = Ext.StoreMgr.get('routeStore');
      // ...
    }
    
    //...
    
    Ext.onReady(function() {
      var routeStore = new Ext.data.Store({
        storeId: 'routeStore',
        proxy: new Ext.data.MemoryProxy(''),
        // ...
    RE:

    When I hosts flex app on my same .aspx page, it also throws Ext is undefined (but page renders and works fine)....
    Without seeing how you've set up your page, it's impossible to tell what's going on.

  3. #3
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751

    Default

    NEVER EVER spam one topic 3 times in the help-forums!

    at least i won't answer persons who do it.



    without kind regards,
    tobiu
    Best regards
    Tobias Uhlig

  4. #4

    Default

    Hey thanksssssss aloottttttt Fay......it solved my problem!!!!
    Now my store automatically gets updated when function is called from Flex app.
    And i checked about that 'Ext undefined' error message, it was because of some mistakes i made in flex application. So, it all fine now...thanks once again!

  5. #5

    Default

    Sorry Tobiu.....now i realized how this thread got spammed. Actually, I stopped my browser twice to edit my first question and didnt realized about it...sorry!

  6. #6
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751

    Default

    you can easily edit your own postings after submitting them.
    even multiple times.
    Best regards
    Tobias Uhlig

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •