14 Replies Latest reply on Jan 12, 2009 11:56 AM by Newsgroup_User

    Datafield includes parent node

    Handycam Level 1
      I am confused. I have a datagrid like always. The dataprovider is my xmllistcollection, I have done this many times.

      the datagridcolumn in question is <mx:DataGridColumn dataField="Botanical_Name"/>

      The data in the xml is:
      <Botanical_Name>
      <em>Dianthus</em> 'Bath's Pink'
      </Botanical_Name>

      And that's exactly what I get in the field -- including the surrounding <Botanical_Name> tags. I want what's IN those tags, as usual not the tags. I cannot change the XML it is coming from a source, I must deal with it as is.

      What am I missing?
        • 1. Re: Datafield includes parent node
          amthekkel Level 1
          is <Botanical_Name> the root element or is it one of the child elements. Seems to me is that it is a child element and therefore is being displayed as is.. If thats the case then you could create a LabelFunction for that column that returns the text of the child element as a string.

          If you want data manipulation, i think item renderers will be the way to go.

          HTH
          • 2. Re: Datafield includes parent node
            Level 7

            "Handycam" <webforumsuser@macromedia.com> wrote in message
            news:gkfoq9$n8c$1@forums.macromedia.com...
            >I am confused. I have a datagrid like always. The dataprovider is my
            > xmllistcollection, I have done this many times.
            >
            > the datagridcolumn in question is <mx:DataGridColumn
            > dataField="Botanical_Name"/>
            >
            > The data in the xml is:
            > <Botanical_Name>
            > Dianthus 'Bath's Pink'
            > </Botanical_Name>
            >
            > And that's exactly what I get in the field -- including the surrounding
            > <Botanical_Name> tags. I want what's IN those tags, as usual not the
            > tags. I
            > cannot change the XML it is coming from a source, I must deal with
            > it as
            > is.
            >
            > What am I missing?

            It looks like it's thinking it has an XMLList instead of an XMLNode or
            something like that. You may find that this problem goes away when you add
            more items to the collection.

            If not, I think you're going to have to use a labelFunction to return
            data.text().

            HTH;

            Amy


            • 3. Re: Datafield includes parent node
              Handycam Level 1
              It's not so simple. Yes, that is a child node. The XML document I am working with is actually an RSS feed. There is a lot of information in there, a lot of it I do not need. My original application was designed to be used with a more customized XML feed, and it worked fine. The client changed it on me to this insane RSS formatting.

              I have temporarily pulled the tile list I was using (with a custom renderer) in order to more easily debug this data. I am currently working with the code below. Clicking an item in the grid should populate the fields above it with the appropriate data items. Where would I put a function to get the actual text? The datagrid is less important than the text field above.

              <mx:VBox>
              <mx:HBox>
              <mx:Image id="largeImage" />
              <mx:VBox>
              <mx:Text id="plantName" text="{tl.selectedItem.Botanical_Name}"/>
              <mx:Text id="plantPhonetic" />
              <mx:TextArea id="plantDetails" text="{tl.selectedItem.Description}" />
              <mx:LinkButton id="plantLink" label="READ MORE" click="goPlant(event)" />
              </mx:VBox>
              </mx:HBox>

              <mx:DataGrid id="tl" dataProvider="{coll}">
              <mx:columns>
              <mx:DataGridColumn dataField="Botanical_Name"/>
              <mx:DataGridColumn dataField="Description"/>
              <mx:DataGridColumn dataField="Phonetic_Transcription"/>
              </mx:columns>
              </mx:DataGrid>
              </mx:VBox>
              • 4. Re: Datafield includes parent node
                Level 7

                "Handycam" <webforumsuser@macromedia.com> wrote in message
                news:gkfs1q$rgj$1@forums.macromedia.com...
                > It's not so simple. Yes, that is a child node. The XML document I am
                > working
                > with is actually an RSS feed. There is a lot of information in there, a
                > lot of
                > it I do not need. My original application was designed to be used with a
                > more
                > customized XML feed, and it worked fine. The client changed it on me to
                > this
                > insane RSS formatting.
                >
                > I have temporarily pulled the tile list I was using (with a custom
                > renderer)
                > in order to more easily debug this data. I am currently working with the
                > code
                > below. Clicking an item in the grid should populate the fields above it
                > with
                > the appropriate data items. Where would I put a function to get the
                > actual
                > text? The datagrid is less important than the text field above.

                <mx:Text id="plantName" text="{tl.selectedItem.Botanical_Name.text()}"/>


                • 5. Re: Datafield includes parent node
                  rtalton Level 4
                  I was unable to reproduce the issue; not enough data to test.
                  • 6. Re: Datafield includes parent node
                    Handycam Level 1
                    Many thanks, that works. However, it is ignoring the part of the text that was in an html tag.

                    For example:
                    <Botanical_Name>
                    <em>Dianthus</em> 'Bath's Pink'
                    </Botanical_Name>

                    Is coming in with just the 'Bath's Pink'. Can I force it to bring in the whole node as text? I don't even care if the html tag is ignored in this case, but I do need the text in it...
                    • 7. Re: Datafield includes parent node
                      Level 7

                      "Handycam" <webforumsuser@macromedia.com> wrote in message
                      news:gkg0lv$4bv$1@forums.macromedia.com...
                      > Many thanks, that works. However, it is ignoring the part of the text
                      > that was
                      > in an html tag.
                      >
                      > For example:
                      > <Botanical_Name>
                      > Dianthus 'Bath's Pink'
                      > </Botanical_Name>
                      >
                      > Is coming in with just the 'Bath's Pink'. Can I force it to bring in the
                      > whole node as text? I don't even care if the html tag is ignored in this
                      > case,
                      > but I do need the text in it...

                      You're setting the wrong property if that is what you want. Set htmlText


                      • 8. Datafield includes parent node
                        Handycam Level 1
                        Yeah, I thought so but:

                        <mx:Text id="plantName" styleName="title" width="100%" htmlText="{tl.selectedItem.Botanical_Name.text()}"/>

                        seems to have no effect.
                        • 9. Re: Datafield includes parent node
                          Level 7

                          "Handycam" <webforumsuser@macromedia.com> wrote in message
                          news:gkg2vn$7as$1@forums.macromedia.com...
                          > Yeag, I thought so but
                          >
                          > <mx:Text id="plantName" styleName="title" width="100%"
                          > htmlText="{tl.selectedItem.Botanical_Name.text()}"/>
                          >
                          > seems to have no effect.

                          If you use that text directly (hardcoded vs. from selectedItem), does it
                          give the desired result?


                          • 10. Re: Datafield includes parent node
                            Handycam Level 1
                            I have tried

                            <mx:Text id="plantName" styleName="title" width="100%" htmlText="{coll[0].content_html.root.Plant.Botanical_Name.text()}"/>

                            where coll is my xmllistcollection. Same thing, i get the text, no <em> content.

                            Could it be a font issue? I had something like this happen in flash once.
                            • 11. Re: Datafield includes parent node
                              Handycam Level 1
                              I have tried adding a field with the font (just the default verdana italic), nothing.

                              I have tried changing the <em> tag to an <i>, no difference.

                              I have tried removing the style, leaving a plain text object.

                              If I can recover this text in the <em> tags, even without the styling, I'd be happy -- and finished!
                              • 12. Re: Datafield includes parent node
                                Handycam Level 1
                                OK, I am now trying

                                <mx:TextArea id="plantDetails" width="100%" htmlText="{tl.selectedItem.content_html.root.Plant.Description.children()}" />

                                This works, but it puts a hard return after the <em> text. Why is that?
                                • 13. Re: Datafield includes parent node
                                  Level 7

                                  "Handycam" <webforumsuser@macromedia.com> wrote in message
                                  news:gkg5tk$b96$1@forums.macromedia.com...
                                  > OK, I am now trying
                                  >
                                  > <mx:TextArea id="plantDetails" width="100%"
                                  > htmlText="{tl.selectedItem.content_html.root.Plant.Description.children()}"
                                  > />
                                  >
                                  > This works, but it puts a hard return after the text. Why is that?

                                  http://flexdiary.blogspot.com/2007/12/problems-with-html-within-xml.html

                                  Check the note at the bottom for your solution.


                                  • 14. Re: Datafield includes parent node
                                    Handycam Level 1
                                    If figured out condenseWhite="true"

                                    Now all I need to do is figure out how to handle the html in tooltips.