DataGrid and HttpService and XML

Hello

I get the following Http service XML. I'm fighting to display it in a Datagrid control. Help, please.
< results >
< result >
< row >
< cell name = "CLASS_GROUP" > cash and equivalents of < / cell >
< cell name 'CLASS' = > Cash < / cell >
< name of cell 'STYLE' = > Cash < / cell >
< / row >
< row >
< cell name = "CLASS_GROUP" > cash and equivalents of < / cell >
< cell name 'CLASS' = > Cash < / cell >
< name of cell 'STYLE' = > Sweep funds < / cell >
< / row >
< row >
< cell name = "CLASS_GROUP" > equity < / cell >
< cell name 'CLASS' = > Asia Equity < / cell >
< name of cell 'STYLE' = > Asia Pacific ex Japan Equity < / cell >
< / row >
< / result >
< / results >

The code to get the xml code is:

< mx:HTTPService
ID = "photoService".
' URL =' http://somehttpservice '
resultFormat = "e4x".
result = "photoResultHandler (Event); »
Fault = "photoFaultHandler (Event); »
/ >
< mx:XMLListCollection id = source="{photoService.lastResult.result.row}"/ "myXC" >

Sorry I misread your message.

Here's what you can do:







and then, inside the extracted display function the value of xml. as:

protected function displayClassGroup (subject: line, column: DataGridColumn): String {}
var xmlObj:XMLList = row.cell;
return xmlObj. (@name is "CLASS_GROUP");
}

Thank you
Gaurav Jain
Flex SDK Team

Tags: Flex

Similar Questions

  • DataGrid and XML

    Can someone identify a problem with the following code:

    < mx: Model id = source = "reading.xml" / "readingData" >
    < mx:ArrayCollection id = source = "{readingData.row}" / "readingAC" >

    < mx:DataGrid id = "readingGrid" dataProvider = "{readingAC}" x = "10" y = "40" lines = '4' width = '675' color = "#000000" >
    < mx:columns >
    < mx:DataGridColumn dataField = "title" headerText = "Title" width = "200" / >
    < mx:DataGridColumn dataField = "author" headerText = "Author" width = "200" / >
    < mx:DataGridColumn dataField = "isbn" headerText = "ISBN" width = "200" / >
    < / mx:columns >

    < / mx:DataGrid >

    I get the error message is:


    External XML parsing problem: C:\Documents and Settings\Ian\My Documents\RIA\src\reading.xml - (line 41) the entity name must immediately follow the '&' in reference to entity.    RIA_Prototype/src Prototype.mxml

    I have an another DataGrid in app that works very well, but it will not - and I do not understand the error message.

    Ian

    Yes, that's all! your xml file is not well formed

    8
    <strong>Angels & Demons</strong>

    you have the symbol and commercial, which is a violation caused your error above.

    I can tell you that the simplest way how sure wether your xml file validates or not,.

    save xml text in Notepad save as extension *.xml and open this file by using Internet Explorer

    Replace & with & and you're done

    If you think this message responds to your question or assistance, please mark respectively

  • Flex 2 and XML

    OK, here's what I need. I looked and looked for a simple explanation of this. Here's what I have to do. I have a PHP the drawee of a mysql database information file and formatting in an XML file. Now, what I need know, it is how can I get that data in a datagrid and control chart in flex. I know I have to use the HTTPService but don't know what else is needed or how to on this subject. Any help is greatly welcome!

    Thanks, but I found a solution. Simple and easy to use.

  • All tables and xml are be NULL problem

    Hello guys

    I'm working on a project that uses the format of loading xml, e4x and intensively, table manipulation and it was fine but now I'm stuck on a strange problem.  All code was beautiful and application work and respond in a desired way, but then mystourisly it stopped working and started to return NULL values in almost all the tables of the (internal) actionscript and XML varibales.

    Now every time I have to load the xml file and set the loaded xml internal variables, internal values get only NULL instead of data.
    The same is the situation with the berries, I created a few components in mxml, and when I passed them to reference tables, the code gets compiled successfully, but again Array has only null values [that code worked very well too]

    I wonder if Adobe Flex did an update reduced to silence or something similar and it's the result of this things!

    I use Adobe Flex 3.2 SDK 3.3 on windows Vista Ultimate Edition.

    Please check this project attached, import it and see if you face the same problem

    Thank you

    Link to the problematic project

    http://isolatedperson.googlepages.com/problemXperiment.zip

    Problem screenshot

    http://isolatedperson.googlepages.com/xmlissue.jpg

    HTTPService to load the data. You will have less problems.

    
    
         
              
         
         
         
    
    
  • How to filter the doc and xml using SDKFileOpenChooser?

    I need to filter only word and xml

    SDKFileOpenChooser openChooser;

    openChooser.AddFilter (291, "App_Filter");   291 for app

    openChooser.ShowDialog ();


    Where to find the ID of the extension for the filter application or any solution?

    To display only the XML using SDKFileOpenChooser files use:

    openChooser.AddFilter (kXMLFileTypeInfoID, "files (xml)" "") XML;

    To Word files, try to use kMSWordFileTypeInfoID instead.

  • Flash CS4 and XML

    Hello

    I use Flash CS4, I have problems by creating an xml file to work

    with action script for a 3D carousel. I created the folder for

    image png icons and xml file using a normal Notepad in windows

    for file works with flash action script 2.0, but in the menu output said msg

    Error opening URL "file:///C|/Users/User/Documents/caroselFile/icons.xml".

    They are not the compiler errors. Notepad or xml editor? I've been

    can I use a normal notebook?

    Maybe I should of saved in the directry fla, but don't know where

    This is the case.

    Thanks Larell

    You can use an absolute path, but the chances of error are much greater than when you use a local path.  In addition, your absolute path does not work when you deploy your swf (on a server under an air or as a file of projection).

    Use a relative path.  the easiest way is to put the xml file in the same directory with your html and swf, fla.  You can then use:

    yourxml. Load ("icons.xml");

    I like to keep xml files in a subfolder of the xml file that contains my html and swf, fla.  in this situation, you would use:

    yourxml. Load("XML/icons.xml");

    but whenever you have a path problem, the best bet after a few checks and emerge from the spelling is to the file to be loaded into the same directory as all flash files and make sure you can get this to work.  then start moving files to create a cleaner more logical Setup, if that suits your needs.

  • DataGrid and &amp; quot; change &amp; quot; the event, called 2nd time problem

    Hello

    I have a datagrid and I use the attribute 'change' to call a function when you click on an item in my datagrid. I use the change attribute because I still want the columns to sort by the column header. In any case, it works the first time around, but if I click on the same element in the list, it does not yet have my function.

    When you click an item in the DataGrid I call the 'navigateToURL()' method and it works the first time, but when you click on the same item in the datagrid control, which is not, I guess he thinks there is no change happening so it does not have the function to call. He's right there.

    Any help appreciated.

    -WestSide

    try to use itemClick

    E.g.
    Script:
    public void clickItem(e:ListEvent):void {}
    If {(myDataGrid.selectedItem)
    navigateToURL()
    ......
    }
    }

    ......

  • akwardness DataGrid and onclick

    Hello

    I have an onclick on my datagrid. When you click the scroll bar in the grid if its there and or column header (sorting) she calls the same function. I understand that both are events click on the grid, but the scroll bar, which seems to be an area on the data grid that shouldn't be my function to call.

    In addition a kind being a click, how can we get around that, I would like to have both the onclick on my datagrid and still be able to click to sort.

    Thank you

    -Westside

    -Westside.

    If you want to detect someone by selecting a line on your datagrid, use the change, not the click event event.

    Tim

  • DataGrid and TitleWindow - problem clicking on header called TitleWindow!

    Hi all

    I'm really puzzled by the present, any help would be greatly appreciated!

    I have a DataGrid and a TitleWindow. I've been using a 'click "command in the DataGrid is click ="launchViewer (event)".

    This is the code for the launchViewer:
    public void launchViewer(event:MouseEvent):void
    {/ * Function launchViewer * /}
    var popUp: ViewWindow = ViewWindow (PopUpManager.createPopUp (this, ViewWindow, false));
    }


    But now I find that if I click on the headers to sort the columns of the datagrid the TitleWindow is called as well! Is there a way to recognize that if I click on a column header the TitleWindow function will not be called?

    I tried to use mouseOver, but this error occurs:
    TypeError: Error #1009: cannot access a property or method of a null object reference.

    Help, please!
    Thank you very much
    Tanz

    Here I have a solution that worked for me:

    I used the Exchange = "dgClicked (event) call" instead of click ="launchViewer (event)" in the defintiion of Datagrid.

    DgClicked function rank controls the clicked cell was. If row 0 (header) was clicked then do a normal sort - that is, do not call the TitleWindow popUp.

    public void dgClicked(event:ListEvent):void
    {
    If (event.rowIndex! = 0) {}
    launchViewer (event);
    }
    }

    The definition of launchViewer also supposed a MouseEvent to a ListEvent:
    public void launchViewer(event:ListEvent):void
    {
    var popUp: ViewWindow = ViewWindow (PopUpManager.createPopUp (this, ViewWindow, false));
    }

    I hope this helps someone else out there!
    T.

  • PL/SQL and XML

    So I have a little problem. I have a request that I need to have to produce XML from. I was initially doing this through htp.prn, but then I realized that some of the data that I was out to and XML file may have special characters in them, namely signs and double quotes. I decided to see if Oracle were all functions to remove special characters and replace them with the HTML counterparts (an ampersand would turn into & amp ;)) I found a few things that seemed useful, but the problem is, with the functions I found, he wanted the data to be strictly out of the database and some of the data I wanted in the XML document was also user entered on the pages. Is there something out there that will search by text AND query results to check that there are no special characters? Thank you.

    -Joshua

    The following function should work for what you are trying to do.

    htp.p(htf.escape_sc(:P1_ITEM));
    

    To escape the database columns simply include in your select statement:

    SELECT htf.escape_sc(COLUMN_NAME) alias
      FROM TABLE
    

    To escape from the elements on your page apex:

    INSERT INTO table
               (COLUMN_NAME)
         VALUES(htf.escape_sc(:P1_ITEM))
    

    Good luck

    Tyson

    Published by: Tyson Janet on November 25, 2008 16:12

  • pls help... problem of parsing and XML datagrid... :(

    I'm building a small application using flex, php and mysqli...

    I'm trying to connect a DataGrid to a php... php analyzes an xml data for the flex... but when I run the program datagrid doesn't get filled... someone can help me... r my code snippets here...

    the name of the database of crm, the table name is led...

    the column names are, respectively, company, fname, and lname...

    <? PHP

    echo "<? XML version=\"1.0\" encoding =------"utf - 8\ '? > ';

    $conn = mysqli_connect ('localhost', 'root', ", 'crm');

    $query = "SELECT * from conduit."

    $result = mysqli_query ($conn, $query);

    echo '< leadsxml > ';

    While ($Row = mysqli_fetch_object ($result))
    {
    echo "< channel > < leadCompany >. $row-> the company. "< / leadCompany > < leadFirstName >. $row-> fname. "< / leadFirstName > < leadLastName >. $row-> lname. "< / leadLastName > < / leads >";
    }

    echo "< / leadsxml > ';

    mysqli_close ($conn);

    ? >

    and the flex part

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:HBox ' http://www.Adobe.com/2006/MXML " >

    < mx:HTTPService url = "getlead.php" id = "getleadHS" showBusyCursor = "true" useProxy = "false" method = "POST" / >

    < mx:DataGrid id = "leadDataGrid" width = "400" height = "240" dataProvider = "{getleadHS.lastResult.leadsxml.leads}" >
    < mx:columns >
    < mx:DataGridColumn headerText = "Company" dataField = "leadCompany" / >
    < mx:DataGridColumn headerText = "First name" dataField = "leadFirstName" / >
    < mx:DataGridColumn headerText = "Last Name" dataField = "leadLastName" / >
    < / mx:columns >
    < / mx:DataGrid >

    < / mx:HBox >

    pls someone help me...

    have you ever actually send the HTTPService?

    and the flex part


    http://www.Adobe.com/2006/mxml">


           
           
        creationComplete = "getleadHS.send ()"> ""
           
               
               
               
           

       
       

  • HTTPService and XML

    Trying to pull back the XML of my twitter stream, but I can't seem to get the code to get the data. However if I run the httpservice url in the browser, it displays the xml file. It's just a proof of concept at the moment. Does anyone have any ideas? Thank you

    Managed to fix when I changed the resultFormat = "e4x" to "oppose" instead which then populate the datagrid control

  • [help] Problem with datagrid and DB

    Hello

    I have a problem with my flex2 app.
    EDIT: happens in all not only in firefox browser

    I use one
    < mx:HTTPService id = "userRequest4" url = "DB.php" useProxy = "false" method = "POST" > "
    < mx:request xmlns = "" >
    < / mx:request >
    < / mx:HTTPService >

    to send a request to a php script what data back to the database, and these data are load in a datagrid in this form:

    < mx:DataGrid id = "dg" width = "100%" height = "100%" dataProvider = "{userRequest4.lastResult.pathis.Product}" editable = "true" itemEditEnd = "getCellInfo (event); ">
    < mx:columns >
    < mx:DataGridColumn dataField = "ID" headerText = "ID" editable = "false" / >
    < mx:DataGridColumn dataField = "number" headerText = "Name" / >
    < mx:DataGridColumn dataField = "price" headerText = "Price" / >
    < mx:DataGridColumn dataField = "S" headerText = "S" / >
    < mx:DataGridColumn dataField = "M" headerText = "M" / >
    < mx:DataGridColumn dataField = "L" headerText = "L" / >
    < mx:DataGridColumn dataField = "XL" headerText = "XL" / >
    < mx:DataGridColumn dataField = "XXL" headerText = "XXL" / >
    < mx:DataGridColumn dataField = "other" headerText = "Other" / >
    < / mx:columns >
    < / mx:DataGrid >

    EDH, I call the php script, when someone clik in the menu option:
    private void menuHandler(event:MenuEvent):void {}
    if(Event.Item.@label=='Manage Product') {}
    Add_Products.visible = false;
    Add_Products.width = 0;
    Add_Products.height = 0;
    Add_design. Visible = false
    Manage_Products.width = 500;
    Manage_Products.height = 500;
    Manage_Products.Visible = true;
    Add_design. Width = 0;
    Add_design. Height = 0;
    userRequest4.url = "MP.php";
    userRequest4.send ();

    }
    }

    and this function updates the DB when the cell is changed:

    private void getCellInfo(event:DataGridEvent):void {}
    var myEditor:TextInput =
    TextInput (event.currentTarget.itemEditorInstance);
    Get the new value of the Publisher.
    var newVal:String = myEditor.text;
    var objN = new Object();
    objN.ids = dg.selectedItem.ids;
    objN.dato = newVal;
    objN.fields = event.dataField;
    userRequest2.url = "UP.php";
    userRequest2.send (objN);
    }

    and have the property to change the cell, and when that happens to update the database, it worked perfectly, no problems, but when to charge datagrid (I send the request to the DB.php) show this value have cells before that have edited :/
    you know a way to fix it?
    If someone knows please help me, I have urgent need of this :D

    Kind regards
    Shadow.

    try to add dummy prameter to your url in the httpservice which will force the browser not to cache xml

    for exempla, you can add '? blabla = "+ {new Date () .milliseconds}"

  • N000bie - woes headerText DataGrid and data...

    Hello

    So, I have not worked with before DataGrid so far; what I'm trying to do is to enter the data of the first line of xmlDP, '< team >' and uses these attributes as the column headerText property (for example: 1. Chk, 2 Nam0rz, 3 medium, etc...). I can get it going, but I can not insert my data once I have change the col.headerText. through addColumn. See the comments in the code below for more than a description, but considering how the DataGrid control is a new paradigm for me, I know that I do this wrong of all.

    If anyone can help me tame this code together in order to achieve the desired result, or explain how best to build the code below in order to get the desired result, I appreciate it.

    import fl.data.DataProvider; 
    import fl.controls.dataGridClasses.DataGridColumn; 
    import fl.data.DataProvider; 
    import fl.controls.DataGrid; 
    import fl.data.DataProvider; 
    
    var loader:URLLoader = new URLLoader; 
    var aDg:DataGrid = new DataGrid(); 
    
    var xmlDP:XML = <team col0="1. Chk" col1="2. Nam0rz" col2="3. Average" col3="4. DATA" col4="5. DATA2"> 
                    <player checkBox="" name="Player G" avg="0.493" data="BLAH 7" data2="BLAH 17"/> 
                    <player checkBox="" name="Player H" avg="0.414" data="BLAH 8" data2="BLAH 88"/> 
                    <player checkBox="" name="Player I" avg="0.517" data="BLAH 9" data2="BLAH 19"/>     
                    <player checkBox="" name="Player J" avg="0.693" data="BLAH 10" data2="BLAH 20"/> 
                    <player checkBox="" name="Player K" avg="0.714" data="BLAH 11" data2="BLAH 21"/> 
                    <player checkBox="" name="Player L" avg="0.817" data="BLAH 12" data2="BLAH 22"/> 
    </team>;
    
    createDataGrid();
    
    function createDataGrid():void 
    { 
        aDg.move(400, 40); 
        aDg.width = 500;    
        aDg.rowCount = aDg.length;     
        var i:int;
        var attrArray:Array = [];    
        var nodeArray:Array = [];    
        
        for each (var att:XML in xmlDP.@*)
        {
            aDg.rowCount = i; 
            attrArray.push(xmlDP.@*[i]);
            trace("attrArray = "+ attrArray[i]);
            var col:DataGridColumn = new DataGridColumn(attrArray[i]); 
            
            //if I comment out the next line, I get all the data I want, but lose the headerText I want.
            //If I don't comment it out, I get the headerText I want, but lose the data I want.
            //aDg.addColumn(col);
            col.headerText = String(attrArray[i]);                
            i++;        
            var myString:String;                    
        }    
        var myDP:DataProvider = new DataProvider(xmlDP);         
        aDg.dataProvider = myDP;   
        addChild(aDg); 
    }
    

    Thank you muchleh,

    Chipleh

    which is not sensible to what you say in your first post and it makes no sense watching the player xmllists.

    Looks like you want the name of the attribute of the players to be column headings.

    Try this:

    var colA: Array = ['checkBox', 'name', 'avg', 'data', 'data2'];

    aDg.columns = colA;

    var dp:DataProvider = new DataProvider (xmlDP);

    aDg.dataProvider = dp;

  • Problem with spark list and XML dataProvider

    I am VERY new to Flex so I'm probably doing something wrong, but I hope it means this will get a quick response.

    I use a list of spark related to a data provider. On the actions of the user, the list will be filtered. The problem I encounter is that when the xml result is one, she will eventually launch an error:

    Has no type constraint: cannot convert mx.utils::ObjectProxy to mx.collections.IList.

    Here is the code to reproduce the problem...

    Main.MXML

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
     xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
     <fx:Script>
     <![CDATA[
      
     protected function singleItemButton_clickHandler(event:MouseEvent):void
     {    
      ItemService.send();    
     }
     protected function mutliItemButton_clickHandler(event:MouseEvent):void
     {
      var dataObject:Object = new Object();
      dataObject.multi = "yes";
      ItemService.send( dataObject );
     }
     ]]>
     </fx:Script>
    
     <fx:Declarations>
      <s:HTTPService    
       id="ItemService" 
       url="http://myserver/xml/itemXML.cfm" />   
     </fx:Declarations>
    
     <s:List id="theList" 
      x="60" y="29" width="200" height="251" 
      dataProvider="{ItemService.lastResult.items.item}" labelField="name"/>
    
     <s:Button x="77" y="287" label="Single Item" click="singleItemButton_clickHandler(event)"/>
     <s:Button x="172" y="287" label="Multi-Item" click="mutliItemButton_clickHandler(event)"/>
    
    </s:Application>
    

    itemXML.cfm

    <cfsetting showDebugOutput="No">
    <cfxml variable="result">
     <items>
            <item>
                <name>Item One</name>
            </item>
      <cfif isDefined('url.multi') AND '#url.multi#' EQ 'yes'>
                <cfoutput>
                <item>
                    <name>Item Two</name>
                </item>
              </cfoutput>
            </cfif>
       </items>
    </cfxml>
    <cfoutput>#result#</cfoutput>
    

    http://blogs.Adobe.com/aharui/2007/03/arraycollection_arrays_and_ser.html

Maybe you are looking for