6 Replies Latest reply on Mar 5, 2009 11:37 PM by

    Apply Image to datagrid row

      hi

      i have one problem i need to apply image to selected row in datagrid dynamically we have
      "selectedcolor" but i need to apply image to selected row is there any way please help me
      client requires this effect

      karthik.k

        • 2. Re: Apply Image to datagrid row
          hi Madhav Subedi
          thanks for the reply but i already use itemRenderer but when a click is made to the selected row i need to apply image not during datagrid load if you want i will post my code
          karthik.k

          • 3. Re: Apply Image to datagrid row
            Madhav Subedi Level 4
            please post your code, let me look if i can help
            • 4. Re: Apply Image to datagrid row
              hi thanks for the reply i am posting sample code

              <DataGrid id="dg_getData1" backgroundColor="0x87A3B7" selectionColor="0xE4C38D" verticalScrollPolicy="off" horizontalScrollPolicy="off" itemClick="getIdForPresenter()" wordWrap="true" width="100%" verticalGridLines="false" backgroundAlpha="0.3" headerHeight="0" fontSize="20" rowHeight="53" dataProvider="{model.filteredCollection}" useRollOver="false" horizontalGridLineColor="0xFFFFFF" horizontalGridLines="true">
              <columns>
              <DataGridColumn width="30" dataField="sessionTimes" >
              <itemRenderer>
              <Component>
              <HBox horizontalScrollPolicy="off">
              <Script>
              <![CDATA[
              import mx.controls.Alert;
              override public function set data(value:Object):void
              {
              var s_String1:String;
              var s_String2:String;
              var s_String3:String;
              var num:Number
              super.data=value;
              s_String1=sessionTimes.text;
              var arr_Array:Array=s_String1.split(" /");
              for(var i:int;i<arr_Array.length;i++)
              {
              s_String3=arr_Array[0]
              sessionTime.text=s_String3
              s_String2=arr_Array[1];
              /* num=arr_Array[2]
              if(num%2==0)
              {
              setStyle("backgroundColor",0x8EA9BB);
              }
              else
              {
              setStyle("backgroundColor",0x6B8FAB);
              } */
              if(s_String2=="NOT RECEIVED")
              {
              sessionTime.styleName='textcolor';
              }
              else
              {
              sessionTime.styleName='textcolor1';
              }
              }
              }
              ]]>
              </Script>
              <Label id="sessionTime" />
              <Text id="sessionTimes" text="{data.sessionTimes}" visible="false"/>
              </HBox>
              </Component></itemRenderer>
              </DataGridColumn>
              </DataGrid>

              i am using itemrenderer i need to place an image and when that row is clicked i need to display image for the row clicked and when next row clicked previously clicked image should disappear and currently clicked row should be displayed with image(every thing dynamically)
              only option i saw is "selectionColor="0xE4C38D" but i don't know how to place image instead of "selectionColor" for button we have style effect (upskin, downskin) where we can embed image but in datagrid any option like that,
              any idea this requirement is severe

              please help me

              karthik
              • 5. Re: Apply Image to datagrid row
                Madhav Subedi Level 4
                try following, hope it works:
                1 person found this helpful
                • 6. Re: Apply Image to datagrid row
                  hi
                  thanks for your help

                  but it did not work

                  any idea

                  please help