My datagrid refuses to scroll (newbie)

While working on a AIR project, I have created a several datagrids which will not scroll vertically. When the dataprovider is a hard-coded array, they work, but then when I bind to an array that results from a SQLLite SELECT statement, the data is displayed just fine, but the datagrid won't scroll beyond the visible rows.
When I drag the scrollbar handle down, it pops back up to the top as soon as I release the mouse button. If I hold the mouse button down on the bottom scroll bar arrow, it flickers (it scrolls down a row and pops back up to the top within a few milliseconds). If I position the mouse pointer inside the list and flick the mouse scroll wheel very quickly, it will scroll down a few rows. As soon as I move the mouse pointer over the scroll bar, the list goes back to the top again.
Has anybody seen this kind of behavior before?
Code for datagrid and the panel that contains it:
<s:Panel x="483" y="372"     width="
200" height="238"     title="
Commonly Used Buyer(s)"     fontSize="
14">
     <mx:DataGrid x="10" y="15"          dataProvider="
{buyerCollection}"          fontSize="
12" fontWeight="bold"          width="
178" height="100">
          <mx:columns>
               <mx:DataGridColumn headerText="Buyer Name" dataField="BUYE_NAME"/>
          </mx:columns>
     </mx:DataGrid>
</s:Panel>

I figured it out!
The problem was caused by me calling the data retrieval functions from the render event of a component. I did this because the component is only visible when the user switches to a certain application state. The component contains many datagrids and other bound controls, so I didn't want to retrieve data into its controls unless the user chose to switch to that state. Unfortunately, it seems that the render event fires over and over again. In fact, I suspect that it re-fired whenever data was displayed in the controls, so an endless loop was occurring.
I have moved the retrieval logic to the application itself. This solved my datagrid scrolling problem. Unfortunately, this adds overhead and prevents me from achieving my original goal of loading the data only when the state is changed.
If anyone has a suggestion for a good way to load data on state change, I would be interested. I suppose that I could put back it on the render event and set a "dataLoaded" flag variable to true after loading. On the render event, I would only load the data if the variable was false. I'm sure there's a better event or technique out there.
Many thanks to all those who responded. The suggestions that an event was firing repeatedly certainly pointed me in the right direction!

Similar Messages

  • Wireless Mighty Mouse Refuses To Scroll Up

    Hello, I have a small issue.
    My wireless mighty mouse suddenly refuses to scrcoll up. I changed the batteries, reconfigured it in Sys Preferences. It will scroll every direction but up.
    Do any of you fine people have an idea of what is wrong?
    Thanks

    The problem is, they are not designed to be taken apart. They are stuck together with some serious glue. By the time you get it apart, the thing is already a bit of a mess with possible broken bits. And to get it back together is going to need more glue. I can almost guarantee it will look a mess by then. And thats if it still works at all after the surgery. They are quite intricate things inside, even more so the wireless ones.
    I've done the job to a couple of these mice, and already 1 of them is acting up again. I dont think it will survive another operation, so it will most likely get binned and substituted with a Logitech, or similar.

  • Dynamic DataGrid + slow horizontal scrolling

    Can anyone explain why my datagrid horizontal scrolling is so
    slow:
    Demo
    www.smithkjaer.dk/flex/TestComp.htm
    Source
    www.smithkjaer.dk/flex/srcview/index.html
    Depending on your connection it can take a few seconds to
    start due to a large number of columns being generated dynamically
    out from the xml source.
    Note: If I disable the datagrids scrolling and scroll it in a
    canvas there is no performance problem when scrolling, except i
    miss my column header labels when vertical scrolling is used.
    If I disable my dataProvider and build the dataGrid without
    adding data it also scrolls fast

    I have now filed this as a bug which has been confirmed,
    which you can read about here :
    http://bugs.adobe.com/jira/browse/SDK-14361
    Please vote for this bug to be fixed

  • JTextArea refuses to scroll.

    Having just read through some old post and not getting any change i thought i would post.
    I have two JTextArea (They used to be JEditorPanes, but i grew tired of the slow down from the ever growing return of getText) and when they were JEditorPanes, they would scroll. But now they wont.
    Below is an code stub...
    else {
         outputText =  "Prepared to overwrite "     + destination_locale.getAbsolutePath() + "...";
         outputEditor.append(outputText);
         outputEditor.setCaretPosition(outputEditor.getDocument().getLength());
    }And yes the TextArea is inside a ScrollPane...
              // Initialize the outputEditor.
              outputEditor = new JTextArea();
              outputEditor.setEditable(false);
              outputEditor.setPreferredSize(new Dimension(500, 150));
              outputEditor.setMaximumSize(new Dimension(500, 150));
              // Attach the outputEditor to its scroll.
              scroll2 = new JScrollPane(outputEditor);
              scroll2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    1. Review http://java.sun.com/docs/books/tutorial/uiswing/components/textarea.html
    2. Post a small example program that compiles and exhibits the problem.
    3. Please post future Swing questions in the Swing forum.

  • Mighty Mouse refuses to scroll down

    I've had my mighty mouse since early '08 so i think it's out of warranty(not sure). about 10 months ago the it started to have problems scrolling down. i ignored it and strangely it started working again about a month later.... no cleaning with the paper or damp cloth, no resetting of the PMU. then about a month ago the down and up scroll went out. i tried the PMU thing no go. then cleaning with the with the paper and damp cloth. that worked! but only for the up, the down still doesn't work. is there anything, short of cracking it open with a knife, to get the down working again?
    oh and if it helps, when i scroll any way OTHER than down, the ball makes a very quiet clicking noise, but when i scroll down it doesn't.
    Thanks for any help

    Hi Cort...-
    Greetings and welcome to the Apple Discussion boards
    Try rolling it on the white sheet of paper again, with emphasis on vigorously rubbing.
    Others have reported luck with holding down the mouse ball and spraying a spritz of compressed air inside in order to dislodge the bugger or other debris.
    Luck-
    -DP

  • My iPad sometimes refuses to scroll when I bring up sites on Google... I have to bring up a new page or exit the app to correct the problem.  Is this a known issue?  How might I fix it?

    It can go for days with no problem, then it'll randomly balk, even on sites with which I never have had problems previously.  I can't scroll up or down, though the window will slide left or right with no difficulty whatsoever.  Help?

    Hi Casey ,
    You can check the properties of that calender option and if there is an option of opening the calender in the same page ,then please select that.
    Or is it with the help of button option you have created the calender?
    Regards
    Sukrit Dhingra

  • DataGrid Horizontal Scroll Problem when datagrid contains Item renderer

    I have datagrid with horizontal scroll policy enabled. Grid
    contains some item renderer also.One of the item renderer is
    datefield when i select a date from the datefield and say the
    adjacent cell of the grid also contain datefield itemrenderer
    and i am selecting date from that itemrenderer also.When i
    scroll horizontally the date in the itemrender changes to any one
    of the two itemrenderer.Some time it works fine.I am getting the
    issue for combobox itemrender also.Can any one help me to solve
    this issue.

    "happybrowndog" <[email protected]> wrote in
    message
    news:ge11ag$jdo$[email protected]..
    >
    quote:
    Originally posted by:
    ravi_bharathii
    > I have datagrid with horizontal scroll policy enabled.
    Grid contains some
    > item
    > renderer also.One of the item renderer is datefield when
    i select a date
    > from
    > the datefield and say the adjacent cell of the grid also
    contain datefield
    > itemrenderer
    > and i am selecting date from that itemrenderer also.When
    i scroll
    > horizontally
    > the date in the itemrender changes to any one of the two
    itemrenderer.Some
    > time
    > it works fine.I am getting the issue for combobox
    itemrender also.Can any
    > one
    > help me to solve this issue.
    >
    > Ravi, I am having a similar problem. I subclass a
    TextInput as an
    > itemrenderer for a column in a datagrid. My subclassed
    TextInput checks
    > to see
    > the value in the overriden set() method, and depending
    on the value, sets
    > the
    > background color of the TextInput to green. When the
    datagrid scrolls
    > horizontally, some unrelated cell colors also change
    green and some of the
    > data
    > gets duplicated in the cells. The underlying data
    provider's data is not
    > confused however. Seems the rendering is screwed up when
    the Datagrid
    > scrolls.
    >
    > Did you find a solution to this problem? I think
    Datagrid is a piece of
    > screwed up code.
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf
    Q2

  • Flex Spark Datagrid - Scalable (font size) with No scroll Bars

    I was wondering what would be the most optimized way to scale (increase/decrease) the fonts size in a Spark DataGrid with NO Scroller, so as to make it when the User Resizes the DataGrid, the Fonts inside the Grid would increase/decrease. 
    Is there a way to listen for the size change of the DataGrid? 
    I would probably need to change the font size to increase/decrease as the event gets fired on Datagrid Resize. 
    Any suggestions?

    I've pasted as much code as I can legally can.  What i would like to achieve is that when the the window resizes, the Content & the DataGrid Scales. I am also aware of scalemode on the VBox, though it scale oddly with width more than height (this is internal).
    Else, I tried:
    protected function vgroup1_addedToStageHandler(event:Event):void
                //stage.scaleMode = StageScaleMode.EXACT_FIT;
                stage.scaleMode = StageScaleMode.SHOW_ALL;
                stage.align = StageAlign.TOP_LEFT;
                scaleX = .5;
                scaleY = .5; 
                /* if(stage.stageWidth != (event.currentTarget as VGroup).width || stage.stageHeight != (event.currentTarget as VGroup).height)
                    var scaling:Number = 1;
                    if(width>height)
                        scaling = stage.stageWidth / (event.currentTarget as VGroup).width;
                    else
                        scaling = stage.stageHeight / (event.currentTarget as VGroup).height;
                    scaleX = scaleY = scaling;
    == THIS IS All I can Post ==
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:components="components.*"
         viewSourceURL="srcview/index.html">
        <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            import mx.events.ResizeEvent;
            import mx.rpc.events.ResultEvent;
            import mx.rpc.xml.SimpleXMLDecoder;
            import mx.utils.ArrayUtil;
            import mx.utils.ObjectUtil;
            import spark.components.ResizeMode;
            import spark.effects.Resize;
            // Skin Colors
            private const ALTERNATING_GRID_COLOR:Array = [ 0xF5F5F0 , 0xE7E4E9 ];
            private const ROLL_OVER_COLOR:int = 0x6D9960;
            private const SELECTION_COLOR:int = 0x668F59;
            private const TEXT_FONT_SIZE:int = 11;
            private const TEXT_COLOR:int = 0x080808;
            private const SUMMARY_TEXT_COLOR:int = 0xFAAFFF;
            // First column width
            private var collectiveFirstColumnWidth:int = 160;
            private var collectiveValuesColumnWidth:int = 50;
            // XML data
            [Bindable] private var portfolioSummary1:XMLList;
            [Bindable] private var reconstructedAC:ArrayCollection;
            private function convertXmlToArrayCollection(file:String):ArrayCollection {
                var xml:XMLDocument = new XMLDocument(file);
                var decoder:SimpleXMLDecoder = new SimpleXMLDecoder();
                var data:Object = decoder.decodeXML(xml);
                var array:Array = ArrayUtil.toArray(data);
                return new ArrayCollection(array);
            private function convertToAC():void {
                var ac1:ArrayCollection = convertXmlToArrayCollection(psr1)
                trace(ObjectUtil.toString(ac1));
                //reStructureAC(ac1);
            private function restructureXMLIntoHierarchicalAC():void {
            private function addProperty(obj:Object, attribute:String, value:String):Object {
                var o:Object = obj;
                o[attribute] = value;
                return o;
            protected function httpservice1_resultHandler(event:ResultEvent):void
                portfolioSummary1 = event.result.Analytics.Side.Analytic as XMLList;
                trace('-----\nSide: Sell' + ObjectUtil.toString(event.result.Analytics.Side.(@name=='Sell')));
                trace('-----\nSide: Buy: Analytic Values : \n' + ObjectUtil.toString(event.result.Analytics.Side.(@name=='Buy').Analytic.@value));
                //dg.dataProvider = new XMLListCollection(portfolioSummary1);
                //dg.requestedRowCount = dg.dataProviderLength;
            protected function vgroup1_addedToStageHandler(event:Event):void
                //stage.scaleMode = StageScaleMode.EXACT_FIT;
                stage.scaleMode = StageScaleMode.SHOW_ALL;
                stage.align = StageAlign.TOP_LEFT;
                scaleX = .5;
                scaleY = .5; 
                /* if(stage.stageWidth != (event.currentTarget as VGroup).width || stage.stageHeight != (event.currentTarget as VGroup).height)
                    var scaling:Number = 1;
                    if(width>height)
                        scaling = stage.stageWidth / (event.currentTarget as VGroup).width;
                    else
                        scaling = stage.stageHeight / (event.currentTarget as VGroup).height;
                    scaleX = scaleY = scaling;
            protected function vgroup1_resizeHandler(event:ResizeEvent):void
                (event.currentTarget as VGroup).resizeMode = ResizeMode.SCALE;
        ]]>
        </fx:Script>
        <fx:Declarations>
            <fx:XML id="psr1" source="data/PortfolioSummaryResponse1.xml" />
            <fx:XML id="psr2" source="data/PortfolioSummaryResponse2.xml" />
            <fx:XML id="psr3" source="data/PortfolioSummaryResponse3.xml" />
            <s:XMLListCollection id="headXMLListCol"
                source="{psr1.children()}" />
            <s:HTTPService id="portfolio_HS" result="httpservice1_resultHandler(event)"
                resultFormat="e4x" url="data/PortfolioSummaryResponse1.xml" />
        </fx:Declarations>
        <s:VGroup id="vbox" width="100%" height="100%" top="0" left="0" bottom="0" gap="0" addedToStage="vgroup1_addedToStageHandler(event)">
            <!-- First DataGrid -->
            <components:ExpandableDataGrid5 id="dg"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                skinClass="skins.ResizableDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn id="field1" dataField="dataField1" headerText="Portfolio Summary"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"
                            headerRenderer="itemRenderers.HeaderGridItemRenderer"
                            />
                        <s:GridColumn id="field2" dataField="dataField2" headerText="Buy"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            headerRenderer="itemRenderers.RightAlignHeaderGridItemRenderer"
                            />
                        <s:GridColumn id="field3" dataField="dataField3" headerText="Sell"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            headerRenderer="itemRenderers.RightAlignHeaderGridItemRenderer"
                            />
                        <s:GridColumn id="field4" dataField="dataField4" headerText="Total"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            headerRenderer="itemRenderers.RightAlignHeaderGridItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <components:dataProvider>
                    <s:ArrayCollection>
                        <fx:Object dataField1="data1" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data2" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data3" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data4" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data5" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data6" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data7" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data8" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data9" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data10" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data11" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                        <fx:Object dataField1="data12" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data13" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data14" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                        <fx:Object dataField1="data15" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                    </s:ArrayCollection>
                </components:dataProvider>
            </components:ExpandableDataGrid5>
            <!-- Summary Totals -->
            <components:SummaryRow >
                <s:Label text="Summary Totals" fontWeight="bold" color="{SUMMARY_TEXT_COLOR}"/>
                <s:Spacer width="100%" />
                <s:ButtonBar click="convertToAC()"> 
                    <mx:ArrayCollection>
                        <fx:String>Convert to AC</fx:String>
                        <fx:String>CPS</fx:String>
                    </mx:ArrayCollection>
                </s:ButtonBar>
                <s:ButtonBar click="restructureXMLIntoHierarchicalAC()"> 
                    <mx:ArrayCollection>
                        <fx:String>Parse XML</fx:String>
                        <fx:String>15% POV</fx:String>
                    </mx:ArrayCollection>
                </s:ButtonBar>
            </components:SummaryRow>
            <!-- Second Datagrid -->
            <components:ExpandableDataGrid5 id="dg2"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                skinClass="skins.HeadlessDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn dataField="dataField1"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField2"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField3"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField4"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <s:ArrayList>
                    <fx:Object dataField1="data16" dataField2="data2" dataField3="data2"  dataField4="data16"></fx:Object>
                    <fx:Object dataField1="data17" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                </s:ArrayList>
            </components:ExpandableDataGrid5>
            <!-- Summary Totals - values -->
            <components:SummaryRow>
                <s:Label text="Summary Totals - Values" width="100%" fontWeight="bold" color="{SUMMARY_TEXT_COLOR}"/>
            </components:SummaryRow>
            <!-- Third Datagrid -->
            <components:ExpandableDataGrid5 id="dg3"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                skinClass="skins.HeadlessDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn dataField="dataField1"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField2"
                            itemRenderer="itemRenderers.ToolTipItemRenderer"
                            />
                        <s:GridColumn dataField="dataField3"
                            itemRenderer="itemRenderers.ToolTipItemRenderer"
                            />
                        <s:GridColumn dataField="dataField4"
                            itemRenderer="itemRenderers.ToolTipItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <s:ArrayList>
                    <fx:Object dataField1="data18" dataField2="data2" dataField3="data3"  dataField4="data16"></fx:Object>
                    <fx:Object dataField1="data19" dataField2="data3" dataField3="data3" dataField4="data17"></fx:Object>
                </s:ArrayList>
            </components:ExpandableDataGrid5>
            <!-- Percent of Tops -->
            <components:SummaryRow>
                <s:Label text="Percent of Tops" color="{SUMMARY_TEXT_COLOR}" width="100%" fontWeight="bold"/>
            </components:SummaryRow>
            <!-- Fourth DataGrid -->
            <components:ExpandableDataGrid5 id="dg4"
                color="{TEXT_COLOR}"
                rollOverColor="{ROLL_OVER_COLOR}"
                selectionColor="{SELECTION_COLOR}"
                alternatingRowColors="{ALTERNATING_GRID_COLOR}"
                skinClass="skins.HeadlessDataGridSkin"
                >
                <components:columns>
                    <s:ArrayList>
                        <s:GridColumn dataField="dataField1"
                            itemRenderer="itemRenderers.LeftAlignGridItemRenderer"  />
                        <s:GridColumn dataField="dataField2"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField3"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                        <s:GridColumn dataField="dataField4"
                            itemRenderer="itemRenderers.RightAlignGridItemRenderer"
                            />
                    </s:ArrayList>
                </components:columns>
                <s:ArrayList>
                    <fx:Object dataField1="data20" dataField2="data1" dataField3="data1" dataField4="data20"></fx:Object>
                    <fx:Object dataField1="data21" dataField2="data2" dataField3="data2" dataField4="data21"></fx:Object>
                    <fx:Object dataField1="data22" dataField2="data3" dataField3="data3" dataField4="data22"></fx:Object>
                </s:ArrayList>
            </components:ExpandableDataGrid5>
        </s:VGroup>
    </s:Application>
    ExpandableDataGrid5.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                horizontalScrollPolicy="off"
                verticalScrollPolicy="off"
                selectionMode="singleCell"
                variableRowHeight="true"
                requestedColumnCount="4"
                width="100%"
                resizableColumns="false"
                creationComplete="thisDatagrid_creationCompleteHandler(event)"
                >
        <fx:Script>
            <![CDATA[
                 import mx.events.FlexEvent;
                /*import mx.events.ResizeEvent;
                [Bindable] private var oldWidth:int;
                [Bindable] private var oldHeight:int;
                protected function thisDatagrid_resizeHandler(event:ResizeEvent):void
                    oldWidth = event.oldWidth;
                    oldHeight = event.oldHeight;
                    this.invalidateDisplayList();
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                    if (oldWidth < width) {
                        setStyle('fontSize', getStyle('fontSize') + 0.5); // might wanna~ width % height to increase by a certain pt
                        //this.scaleX += .1;
                    } else if (oldWidth > width) {
                        setStyle('fontSize', getStyle('fontSize') - 0.5);
                        //this.scaleX -= .1;
                    trace('unscaledWidth: ' + unscaledWidth);
                    trace('unscaledHeight: ' + unscaledHeight);
                    trace('explicitMinHeight: ' + explicitMinHeight);
                    trace('explicitMinWidth: ' + explicitMinWidth);
                    minHeight = measuredMinHeight;
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
                protected function thisDatagrid_creationCompleteHandler(event:FlexEvent):void
                    requestedRowCount = dataProviderLength;
                    requestedMaxRowCount = dataProviderLength;
                    requestedMinRowCount = dataProviderLength;
                    minHeight = measuredHeight;
                /* protected function datagrid1_addedToStageHandler(event:Event):void
                    stage.scaleMode = StageScaleMode.SHOW_ALL;
                    /*                stage.align = StageAlign.TOP;
                     this.width = stage.stageWidth;
                    this.height = stage.stageHeight;
            ]]>
        </fx:Script>
    </s:DataGrid>
    You can Check other ExpandableDataGrids:
    <?xml version="1.0" encoding="utf-8"?>
    <s:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                resize="thisDatagrid_resizeHandler(event)"
                creationComplete="thisDatagrid_creationCompleteHandler(event)"
                horizontalScrollPolicy="off" verticalScrollPolicy="off"
                selectionMode="singleCell"
                variableRowHeight="true"
                requestedColumnCount="4"
                editable="false"
                width="100%"
                >
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                import mx.events.ResizeEvent;
                protected function thisDatagrid_resizeHandler(event:ResizeEvent):void
                    //event.stopImmediatePropagation();
                    if (event.oldWidth < width) {
                        setStyle('fontSize', getStyle('fontSize') + 0.5); // might wanna~ width % height to increase by a certain pt
                        //this.scaleX += .1;
                    } else if (event.oldWidth > width) {
                        setStyle('fontSize', getStyle('fontSize') - 0.5);
                        //this.scaleX -= .1;
                    minWidth = measuredMinWidth;
                protected function thisDatagrid_creationCompleteHandler(event:FlexEvent):void
                    requestedRowCount = dataProviderLength;
                    requestedMaxRowCount = dataProviderLength;
                    requestedMinRowCount = dataProviderLength;
                    minHeight = measuredMinHeight;
            ]]>
        </fx:Script>
    </s:DataGrid>
    OR
    <?xml version="1.0" encoding="utf-8"?>
    <s:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                horizontalScrollPolicy="off"
                verticalScrollPolicy="off"
                selectionMode="singleCell"
                variableRowHeight="true"
                requestedColumnCount="4"
                width="100%"
                resize="thisDatagrid_resizeHandler(event)"
                creationComplete="thisDatagrid_creationCompleteHandler(event)"
                >
        <fx:Script>
            <![CDATA[
                 import mx.events.FlexEvent;
                 import mx.events.ResizeEvent;
                [Bindable] private var oldWidth:int;
                [Bindable] private var oldHeight:int;
                protected function thisDatagrid_resizeHandler(event:ResizeEvent):void
                    oldWidth = event.oldWidth;
                    oldHeight = event.oldHeight;
                    this.invalidateDisplayList();
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                    if (oldWidth < width) {
                        setStyle('fontSize', getStyle('fontSize') + 0.5); // might wanna~ width % height to increase by a certain pt
                        //this.scaleX += .1;
                    } else if (oldWidth > width) {
                        setStyle('fontSize', getStyle('fontSize') - 0.5);
                        //this.scaleX -= .1;
                    trace('unscaledWidth: ' + unscaledWidth);
                    trace('unscaledHeight: ' + unscaledHeight);
                    trace('explicitMinHeight: ' + explicitMinHeight);
                    trace('explicitMinWidth: ' + explicitMinWidth);
                    minHeight = measuredMinHeight;
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
                protected function thisDatagrid_creationCompleteHandler(event:FlexEvent):void
                    requestedRowCount = dataProviderLength;
                    requestedMaxRowCount = dataProviderLength;
                    requestedMinRowCount = dataProviderLength;
                    minHeight = measuredHeight;
            ]]>
        </fx:Script>
    </s:DataGrid>

  • Issues with DataGrid and scrolling

    Hello, I am having a problem with using the DataGrid class
    and scrolling. In my DataGrid, there is a certain column whose
    renderer factory class includes a custom built dynamically resizing
    text area. As more text is entered in this dynamic text area, it
    resizes vertically to accomidate the new text. I am using this
    component in a custom renderer. As the custom text area resizes, so
    does the renderer itself, and the row in which the renderer is a
    parent shrinks or grows accordingly. My problem is that when I
    scroll through a datagrid whose rows are of differing heights, the
    scroll bar thumb changes size depending on portion of the data grid
    I'm showing. Not only does this look bad, but it also prevents my
    data grid from working as intended. If I could get some feedback on
    a way to fix this problem. I would appreciate it. TIA.

    There isn't any way to "fix" this - the DataGrid is working
    as intended. Scrolling in the list components is item-based, not
    pixel based, so the scrollbar adjusts according to what is visible
    vs what is available. Since itemRenderers are not generated for
    invisible rows there is no way to calculate what size they will be.
    An alternative is to place the DataGrid into a Canvas and
    then set the DataGrid's rowCount to equal the number of records in
    its dataProvider. This will expose all of the rows and created
    itemRenderers for every row. Because the DataGrid is in a
    container, the container will then get a vertical scrollbar.
    The problem with this is that the DataGrid's header will
    scroll out of view and if you have a lot of records, could take
    some time to render. If you like this approach, you can make a
    second DataGrid which sits above the first, has no records, just a
    header while the DataGrid inside of the Canvas has no
    header.

  • Datagrid Scrolling

    Hi,
    I have a datagrid which allow scrolling, but I have also added a colour background based on the cell value however this does not work, i.e. when scrolling the cell colours remain even though the cell background colour should not be.
    Thanks for any advice.

    Hi ,
    Is it possible for you to share just the code snippet which deals with the color change for the datagrid ? We will investigate this at our end and get back to you.
    Thanks and regards,
    Sudeshna Sarkar
    Adobe Flash Professional Team

  • How to avoid blinking / moving of rows in a data grid when you restore the scroll positions

    By Default when an update is made on a data grid, it scrolls to top row. To avoid this when we save the vertical and horizontal scroll
    positions and restore the scroll positions after the update, it causes a blink in the grid (or moving / jumping) of rows. Is there a way to
    avoid this jumping of rows?
    In JavaScript this can be achieved by overriding the scrollToTop / OnLoad methods of datagrid to directly scroll to current scroll
    positions instead of top row. Is there a way to achieve similar feature in flex / actionscript?

    I am calling validateNow().. Also, using verticalScrollPosition to restore the scroller as in the link that you posted.. Reposition is working fine, But the bug filed is regarding BLINKING / JUMPING when this happens (i.e. this blinking is caused because after datagrid edit, during reload the scroller tries to move to  the top by default, then it repositions itself to current edited row as the verticalScrollPosition property is overridden ).. I have to get rid of this blinking.
    In Javascript it is dealt by overriding OnLoad method of datagrid to directly scroll to current scroll position instead of top row during reload so that there is no blinking.
    http://www.sencha.com/forum/showthread.php?13898-Is-there-any-way-to-keep-scroll-position- of-Grid-on-load
    Is there a way to achieve similar feature in flex?
    I am not sure what flex datagrid method to override.. Theres no method like load? What is the datagrid method that is called by default during reload (after datagrid edit) that causes the scroller to go to top?

  • DataGrid scrollToIndex problem

    Hello
    When use
    dataGrid.scrollToIndex(dataGrid.selectedIndex);
    it scrolls, but if the selected is the last row, it displays not full
    How to fix to make it to display the whole last row?

    I would subclass and override scrollToIndex and use the rowInfo to figure
    out if the last line is partially visible.

  • Datagrid last row flickering problem.

    Hi,
        I used flex 3.5 datagrid. It is a complex datagrid with lot of itemrenderers and itemeditors.when my datagrid has vertical scroll and when i scroll datagrid, last row keep on flickering.
         any idea or solution for this problem?   

    my grid contains 6 columns. Among 6, some of the column texts are  visible some of them hided.
    it is only happens to last row of the Datagrid.
    This is happened when i scroll my datagrid vertically.

  • Zen Touch - Can't Scroll Up?

    Had my Zen TOuch about a week, the thing has frozen a few times and now the touch pad just refuses to scroll up, the sensitivites and speeds are identical, eg cenntre scrolls down slowly and the bottom(AND TOP!) scrolls down quickly. Anyone else had problems along these lines? Trouble is I'm going on holiday for 2 months tomorr,w cant really get a replacement for a while. Any ideas?

    Always when you have these kinds of problems try resetting the player and running a disk cleanup. To access the Rescue Mode hold down the play button and KEEP it held down, press the tiny reset switch once, and KEEP the play button held down until the player boots into the Rescue Mode. Choose Disk Cleanup from the menu.

  • Data Scrolling Issue

    I have an application that shows a thumbnail image inside of a cell in a DataGrid.  Not every row must have a thumbnail but can.  If you have few enough items in the datagrid so that scrolling isn't necessary then you add 2 thumbnails at the top of the datagrid which forces the use of the scroll bar in the datagrid then if you try to scroll it jumps back to the top.  As far as I can tell what happens is when those first two rows are no longer visible in the datagrid the image is no longer rendered which allows the row height to go back to normal which in turn makes the rows visible again which in turn requires the use of the scroll bar. Video of the problem occuring can be seen below.  When the images are flashing and the mouse cursor is hovering over the datagrid I am usign the scroll wheel.
    You can find the project here: day2daydevelopment.com/code/ImageInDataGrid.fxp
    Any ideas on what is happening and how to fix it?

    Chris,
    Thanks for the reply!  That resolved the issue for me.  Basically I changed the thumbnail column to look like this
              <mx:DataGridColumn headerText="Thumbnail Image"
                                       dataField="thumbnailUrl"
                                       editorUsesEnterKey="false"
                                       editable="false">
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:Canvas width="100%"
                                           height="100%"                                                  
                                           horizontalScrollPolicy="off">
                                    <mx:Script>
                                        <![CDATA[
                                            override public function set data(value:Object):void {
                                                super.data = value;
                                                if (data.thumbnailUrl != "") {
                                                    this.explicitHeight = 200;
                                                else {
                                                    this.explicitHeight = 20;
                                        ]]>
                                    </mx:Script>
                                    <mx:Image id="viewImage" source="{data.thumbnailUrl}"/>
                                    <mx:LinkButton id="uploadImage"
                                                   icon="@Embed('/assets/tick.png')"
                                                   toolTip="Attach an image to this object."
                                                   click="{outerDocument.uploadImage()}"/>
                                </mx:Canvas>
                            </mx:Component>
                        </mx:itemRenderer>                               
                    </mx:DataGridColumn>
    The fixed project file can be downloaded from day2daydevelopment.com/code/ImageInDataGrid-Fixed.fxp

Maybe you are looking for