0 Replies Latest reply on Aug 12, 2011 1:52 AM by nikos101

    Spark datagrid not behaving properly (maybe states bug)

    nikos101 Level 2

      I am using this as the renderer in my Spark datagrid, however the modified state is getting set when I hover over the row. I've set breakpoints in the set data funtion to see if this is being called, but it is not,

       

      the code  currentState = "modified"; is being called out side of the set data function but I have not written that code anywhere !!!

       

       

       

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

       

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

       

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

       

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

       

                       currentState="unmodified">

       

       

       

          <fx:Script>

       

              <![CDATA[

       

                  override public function set data(value:Object):void

       

                  {

       

                      super.data = value;

       

                      if(data){

       

                          if(this.data.isModifiedClientSide){

       

                              currentState = "modified";

       

                          }

       

                          else{

       

                              currentState = "unmodified";

       

                          }

       

                      }

       

       

       

       

       

                  }

       

              ]]>

       

          </fx:Script>

       

          <s:states>

       

              <s:State name="modified"/>

       

              <s:State name="unmodified"/>

       

          </s:states>

       

          <s:Rect top="0" left="0" right="0" bottom="0">

       

              <s:fill><s:SolidColor color.modified="0xddddff" color="0xFFffff"  /></s:fill>

       

          </s:Rect>

       

       

       


          <s:Rect left="1" top="1" right="0" bottom="0" includeIn="modified">
              <s:stroke >
              <s:SolidColorStroke color="0x000099" weight="1">
                 
              </s:SolidColorStroke>
              </s:stroke>
          </s:Rect>
         
         
         
          <s:VGroup horizontalAlign="center" verticalAlign="middle" top="0" left="0" right="0" bottom="0">
              <s:Label text="{data.margin}">
                 
              </s:Label>
          </s:VGroup>
         
         
      </s:GridItemRenderer>