1 Reply Latest reply on Aug 25, 2012 5:32 AM by Buru Lászlo Zoltán

    Stuck with GridItemRenderer

    Buru Lászlo Zoltán

      Here is my problem. I have a s:GridItemRenderer (the spark DataGrid size where I use this, is: 100% x 100%) and here is the function in it:

      override public function prepare(hasBeenRecycled:Boolean):void {
          myLabel
      .text = width.toString();
      }

      and here is the "myLabel" in it:

      <s:Label id="myLabel" x="0" y="0" width="100%" height="20" paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0"/>

      SO AND THE PROBLEM IS:

      When i drag the side of the window, and resize it everything is fine! myLabel is updating, but sometimes the last column doesn't. BUT when I maximize the window, NOTHING happend, BUT the "width" variable is updated, but the myLabel.text doesn't. (so I try to use this.width too, but it isn't take effects)

        • 1. Re: Stuck with GridItemRenderer
          Buru Lászlo Zoltán Level 1

          The solution I think is (This is good for me, what do You think about this?):

          <?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"

                                                            width="100%" height="100%"

                                                            clipAndEnableScrolling="true"

                                                            resize="griditemrenderer1_resizeHandler(event)">

                    <fx:Script>

                              <![CDATA[

                                        import mx.events.ResizeEvent;

           

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

                                                  lbl.text = column.grid.getColumnWidth(column.columnIndex).toString();

                                        }

           

                                        protected function griditemrenderer1_resizeHandler(event:ResizeEvent):void {

                                                  column.grid.validateNow();

                                        }

           

                              ]]>

                    </fx:Script>

                    <s:Label id="lbl" x="0" y="0" width="100%" height="40" backgroundColor="#FA8888"/>

          </s:GridItemRenderer>