2 Replies Latest reply on Feb 5, 2009 4:59 AM by sinhakmanoj

    Passing parameters to component file

    sinhakmanoj
      Hi all,
      I am a newbie in Flex development. I have created one datagrid and populated with xml file. I have created another component file where I control visibility of images on datagrid through itemrendered property. Initially all images are not visible. I will make them visible as per the parameters sent by application file. Following is the xml file:
      <row>
      <sno>
      1
      </sno>
      <sourceSegmentid>a2804174-a025-4b01-8054-009db0f6c5a4</sourceSegmentid>
      <sourceSegment>
      The company has committed technology and services worth US$1.5 million to the project.
      </sourceSegment>
      <targetSegment>
      Die Firma hat für das Projekt Technik und Service im Werte von 1,5 Millionen US$ eingesetzt.
      </targetSegment>
      <match>fuzzy</match>
      <permatch>95%</permatch>
      <notes>You have made a Note to this segment</notes>
      <errflag>inconsistent</errflag>
      </row>

      <row>
      <sno>
      2
      </sno>
      <sourceSegmentid>a2804174-a025-4b01-8054-009db0f6c5a4</sourceSegmentid>
      <sourceSegment>
      eGate is also providing teachers with expert advice and practical information on how to enhance students' learning experience and maximize student achievement.
      </sourceSegment>
      <targetSegment>
      eGate stellt den Lehrern, zur Verbesserung der Leistung der Schüler, fachkundige Beratung und praktische Informationen bereit.
      </targetSegment>
      <match>exact</match>
      <permatch>95%</permatch>
      <notes>You have made a Note to this segment</notes>
      <errflag>notchangefuzzy</errflag>
      </row>




      I want to send following as parameter to the image controller component file:
      <match>exact</match>
      <permatch>95%</permatch>
      <notes>You have made a Note to this segment</notes>
      <errflag>notchangefuzzy</errflag>

      Please help me to pass parameters on component file. Thanks in advance.
        • 1. Re: Passing parameters to component file
          ntsiii Level 3
          First, a bit of terminology. You do not send data to a "file". The file is just source code for a class definition. You would send data to a component instance.

          However, you do not do this to an item renderer. Item renderers must be data driven. Set the renderer up so that changes to its underlying data cause the behavior you want. Then update the dataProvider as needed and the renderers will do their things.

          ItemRenderers can be difficult. Find an example and modify it, rather than starting from scratch.
          • 2. Re: Passing parameters to component file
            sinhakmanoj Level 1
            Sorry for the late reply. I have solved my problem by accepting your advice. I have made a public function in the itemrenderer and passed values through parameters. In the datagrid there are some graphical images. This is in one editable column. I want to move those with in the rows. Text is possible. When I will put graphical images in place of those texts. Is this possible to move around with in the row or with in the column? What will be the procedure. Please send me with sample codes. One more thing I have to show the xml file to web service developers that I need images in a particular place of the xml file. This is given below: This is in place of {primary}, {secondary},{indexterm} etc. How will I put in XML and code?

            <?xml version="1.0" encoding="utf-8"?>
            <notesTag>
            <row>
            <sno>1</sno>
            <sourceSegmentid>a2804174-a025-4b01-8054-009db0f6c5a4</sourceSegmentid>
            <sourceSegment>{primary} The company has committed technology and services {secondary} worth US$1.5 million to the project.</sourceSegment>
            <targetSegment>{primary} Die Firma hat für das Projekt {secondary} Technik und Service im Werte von 1,5 Millionen US$ eingesetzt.</targetSegment>
            <match>fuzzy</match>
            <permatch>95%</permatch>
            <notes>You have made a Note to this segment</notes>
            <errflag>inconsistent</errflag>
            </row>
            <row>
            <sno>2</sno>
            <sourceSegmentid>a2804174-a025-4b01-8054-009db0f6c5a4</sourceSegmentid>
            <sourceSegment>{primary} eGate is also providing teachers with expert advice and practical
            {secondary} information on how to enhance students' learning experience and maximize student achievement.</sourceSegment>
            <targetSegment>{primary} eGate stellt den Lehrern, zur Verbesserung der Leistung der Schüler,
            {secondary} fachkundige Beratung und {indexterm}praktische Informationen bereit.</targetSegment>
            <match>exact</match>
            <permatch>95%</permatch>
            <notes>You have made a Note to this segment</notes>
            <errflag>notchangefuzzy</errflag>
            </row>
            <notesTag>