0 Replies Latest reply on Jan 16, 2012 7:17 PM by yoyonbo

    Off the Padding on UITextFieldGridItemRenderer and DataGrid

    yoyonbo

      Hi. Now I use the customized UITextFieldGridItemRenderer on spark.components.DataGrid

       

      My purpose is drawing background color of the cell when user click it and dataProvider is changed.

       

      I could draw the color by setting the UITextFieldGridItemRenderer.backgroundColor.

       

      But some pixel paddings are remaining in the cell. I want to fill cell entirely.

       

      I could implement same application by using GridItemRenderer. But it scrolls very slowly.

       

      Does anyone know the way?

       

       

      following is my renderer code.

      --------------------------------------------------------------------------------

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:UITextFieldGridItemRenderer  xmlns:fx="http://ns.adobe.com/mxml/2009"

                                              xmlns:s="library://ns.adobe.com/flex/spark"

                                              xmlns:mx="library://ns.adobe.com/flex/mx" >

       

                <fx:Script>

                          <![CDATA[

                                    import spark.components.gridClasses.GridLayer;

                                    private static const yellow:uint = 0xffff66;

                                    private static const pink:uint = 0xffcccc;

                                    private static const white:uint = 0xffffff;

       

                                    override public function prepare(hasBeenRecycled:Boolean):void {

                                                   var workCode:String = data[column.dataField];

       

                                                   if(workCode != null) {

                                                                  workCode = workCode.substr(4,2);

                                                   }

       

                                                   var newField:String = column.dataField;

                                                   var orgField:String = column.dataField + "_org";

                                                   if(data[newField] != data[orgField]) {

                   this.background = true;

                                                                  this.backgroundColor = pink;

              } else {

                                                                  this.background = false;

                                                   }

       

                                                   label = workCode;

                                    }

       

                          ]]>

                </fx:Script>

      </s:UITextFieldGridItemRenderer >