Professional Web Applications Themes

Data Grid Provider, XML attributes - Macromedia Flex General Discussion

Hi all, I'm trying to populate a dataGrid component with following XML sample: <root> <row> <column name="dataGrid Header 1">Test Data 1.1</column> <column name="dataGrid Header 2">Test Data 1.2</column> </row> <row> <column name="dataGrid Header 1">Test Data 2.1</column> <column name="dataGrid Header 2">Test Data 2.2</column> </row> </root> ---------------------------------------------------------------- I assume that it should be something like below, but I can't find a way to make it work: --------------------------------------------------------------- var dataXML:XMLList = null; function resultHandle(event) { .... dataXML = event.result.root; ... } ---------------------------------------------------------------- <mx:DataGrid dataProvider="{dataXML.row}"> <mx:columns> <mx:DataGridColumn headerText="{dataXML.row[0].column[0].{name}}" dataField="{column[0]}"/> <mx:DataGridColumn headerText="{dataXML.row[0].column[1].{name}}" dataField="{column[1]}"/> </mx:columns> </mx:DataGrid> ------------------------------------------------------------- If anyone has any suggestions/comments, I would much appreciate it. ...

  1. #1

    Default Data Grid Provider, XML attributes

    Hi all,
    I'm trying to populate a dataGrid component with following XML sample:
    <root>
    <row>
    <column name="dataGrid Header 1">Test Data 1.1</column>
    <column name="dataGrid Header 2">Test Data 1.2</column>
    </row>
    <row>
    <column name="dataGrid Header 1">Test Data 2.1</column>
    <column name="dataGrid Header 2">Test Data 2.2</column>
    </row>
    </root>
    ----------------------------------------------------------------
    I assume that it should be something like below, but I can't find a way to
    make it work:
    ---------------------------------------------------------------
    var dataXML:XMLList = null;
    function resultHandle(event) {
    ....
    dataXML = event.result.root;
    ...
    }
    ----------------------------------------------------------------
    <mx:DataGrid dataProvider="{dataXML.row}">
    <mx:columns>
    <mx:DataGridColumn headerText="{dataXML.row[0].column[0].{name}}"
    dataField="{column[0]}"/>
    <mx:DataGridColumn headerText="{dataXML.row[0].column[1].{name}}"
    dataField="{column[1]}"/>
    </mx:columns>
    </mx:DataGrid>
    -------------------------------------------------------------
    If anyone has any suggestions/comments, I would much appreciate it.
    Thanks

    the_lastBoyScout Guest

  2. #2

    Default Re: Data Grid Provider, XML attributes

    Hi there,

    I am looking for a solution like yours, but it seems that flex does not like
    much the XML attributes nor xpath syntax.

    As a workaround, I would modify your source XML to be
    <row>
    <column>
    <dataGridHeader1>Test Data 1.1</dataGridHeader1>
    </column>
    <column>
    <dataGridHeader2>Test Data 1.2</dataGridHeader2>
    </column>
    </row>

    This way, you can take the appropriate value by describing
    <mx:DataGridColumn headerText="{dataXML.column.dataGridHeader1}"
    dataField="{column[0]}"/>
    <mx:DataGridColumn headerText="{dataXML.column.dataGridHeader2}"
    dataField="{column[1]}"/>

    Hope it helps. Let me know if you find the REAL solution to read attributes
    and Xpath,

    Best regards,
    Miguel

    Miguelitez Guest

  3. #3

    Default Re: Data Grid Provider, XML attributes

    Try re-working your solution to assign the event.result to the XMLList instead
    of event.result.root. The "root" node is implied. If you assign
    event.result.row to the XMLList variable you will have a collection of rows.

    xmlData = event.result.row;
    trace(xmlData); // you should see an xml fragment containing just "row"
    objects.

    Hope this helps.

    Dan



    dan19460 Guest

Similar Threads

  1. Replies: 3
    Last Post: June 6th, 10:56 AM
  2. xml into a data provider
    By dragonair1 in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: May 25th, 05:44 AM
  3. HTML Returned in Data provider as XML
    By leotemp in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: July 6th, 02:22 AM
  4. Data Grid isn't allowing modification of UI attributes
    By Jason Reposa in forum Macromedia Flash
    Replies: 3
    Last Post: April 29th, 04:28 AM
  5. Data Provider for .NET interface to DB2 8.1
    By Fred Prose in forum IBM DB2
    Replies: 1
    Last Post: September 9th, 10:18 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139