2 Replies Latest reply on Apr 21, 2008 1:28 PM by dan19460

    DataGrid  dataProvider XML with Namespaces,

    MESTREGAFANHOTO
      I have a DataGrid wich dataProvider is a XMLList. The problem is that, the xml has a default namespace, and in my DataGridColumns I use the dataField property to define wich XML field should be displayed. The problem is that the dataField property is used in a way that do not take into consideration the xml namespace.

      I'm already using the use namespace directive with the right namespace, but that doesn't work.

      Has anyone tried to do something similar?
        • 1. Re: DataGrid  dataProvider XML with Namespaces,
          Gregory Lafrance Level 6
          I would see these Flex help topics:
          Using XML namespaces
          A quick introduction to XML
          • 2. Re: DataGrid  dataProvider XML with Namespaces,
            dan19460
            This is similar to a problem I stumbled into described in another post. What I ended up doing was creating a labelFunction for each column and using the value (without the namespace) as the element name. In ActionScript you can use the QName to get a child element:

            private function getItemValue(data:Object, column:DataGridColumn):String {
            return data.child(new QName(mb, column.dataField));
            }

            Note that "mb" was a namespace variable I declared at a module level. I couldn't find a more elegant way of overcoming this namespace deficiency of the built in controls. I suppose you could also extend the DataGrid control, add a namespace attribute and override the appropriate function that provides the default rendering. However, that is something for another day.... Hope this helps.

            Dan