0

我已经用项目渲染器完成了分层数据网格。一切正常。我有很多数据要显示在网格中,所以每次加载数据时都会显示滚动条。拖动滚动条时,项目渲染器无法正常工作,并且缺少一些数据列数据。我知道如何解决这个问题吗?

在这里找到图片图片点击

请检查以下代码:- `width="100%" height="100%" textAlign="center" autoDrawBackground="false">

<fx:Script>
    <![CDATA[
        import com.hp.pmm.common.ImageLibrary;

        import mx.collections.ArrayCollection;
        import mx.controls.Alert;
        import mx.resources.ResourceManager;
        private var _data:Object;           

        override public function set data(value:Object):void
        {               
            super.data = value;
            var showButton:String= '';
            var i:int=0;
            var j:int=0;

            var showDataForChildren:String;

            if(value.hasOwnProperty("Data_Transfer")) 
            {               
                showButton = value.Data_Transfer;

                if (showButton == "Show_Button") {

                    startId.visible= true;
                    startId.includeInLayout= true;
                    abortId.visible= true;
                    abortId.includeInLayout= true;
                    imgStatus.visible=false;
                    lblStatus.visible= false;
                    imgStatus.includeInLayout= false;
                    lblStatus.includeInLayout= false;
                }else {
                    lblStatus.text = "--";
                    startId.visible= false;
                    abortId.visible= false;
                    startId.includeInLayout= false;
                    abortId.includeInLayout= false;
                    imgStatus.includeInLayout= true;
                    lblStatus.includeInLayout= true;

                }

            }
        }


        public function clickedOnStart(event:Event):void{

            var startEvent:Event = new Event("clickOnStartButton");
            var parent:EventDispatcher = parentDocument.parentDocument as EventDispatcher;
            if (parent != null)
            {
                parent.dispatchEvent(startEvent);
            }
        } 


        public function clickedOnAbort(event:Event):void{

            var abortEvent:Event = new Event("clickOnAbortButton");
            var parent:EventDispatcher = parentDocument.parentDocument as EventDispatcher;
            if (parent != null)
            {
                parent.dispatchEvent(abortEvent);
            }
        } 


    ]]>
</fx:Script>

<s:HGroup width="100%" gap="5" verticalAlign="middle" horizontalAlign="left" height="100%">
    <!--<mx:Image id="imgStatus"/>
    <mx:Label id="lblStatus" textAlign="left" showTruncationTip="true"  paddingTop="3"/>-->
    <s:HGroup verticalAlign="middle" horizontalAlign="center">              
        <mx:Button label="Start" id="startId" click="clickedOnStart(event)" width="40"  height="20"/>
        <mx:Button label="Abort" id="abortId" click="clickedOnAbort(event)" width="40"  height="20"/>
    </s:HGroup>
    <s:HGroup height="100%">    
            <mx:Image id="imgStatus"/>
            <mx:Label id="lblStatus" textAlign="left" showTruncationTip="true"  paddingTop="3" />
    </s:HGroup>


</s:HGroup>

`

4

1 回答 1

0

在没有看到您的任何代码的情况下,我猜测这是项目渲染器工作方式的问题。它们被回收利用,过去也给我带来了问题。我敢打赌,您的数据在首次加载时会正确显示,并且在您开始滚动之前不会开始混乱。

看看这个谷歌搜索的结果:

https://www.google.com/search?q=flex+spark+datagrid+virtual+layout&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#hl= en&client=firefox-a&hs=L4Y&rls=org.mozilla:en-US%3Aofficial&sclient=psy-ab&q=flex+datagrid+itemrenderer+recycling&oq=flex+datagrid+itemrenderer+rec&aq=0A&aqi=q-A1&aql=&gs_l=serp.3.0。 33i29.347849.348490.2.350175.3.3.0.0.0.266.752.2-3.3.0...0.0.ULkB2IYzfzs&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=fc477bf602 =979

编辑:添加以下代码以响应提供的示例代码

        if(value.hasOwnProperty("Data_Transfer")) 
        {               
            showButton = value.Data_Transfer;

            if (showButton == "Show_Button") {

                startId.visible= true;
                startId.includeInLayout= true;
                abortId.visible= true;
                abortId.includeInLayout= true;
                imgStatus.visible=false;
                lblStatus.visible= false;
                imgStatus.includeInLayout= false;
                lblStatus.includeInLayout= false;
            }else {
                lblStatus.text = "--";
                startId.visible= false;
                abortId.visible= false;
                startId.includeInLayout= false;
                abortId.includeInLayout= false;
                imgStatus.includeInLayout= true;
                lblStatus.includeInLayout= true;

            }

        }
        else
        {
            //set all values to your equivalent of no data
        }
于 2012-05-02T11:46:12.423 回答