将heirarchical datagrid与项呈示器一起使用时,滚动条会产生问题

时间:2012-05-02 11:32:38

标签: actionscript-3 flex4

我使用项呈示器完成了分层数据网格。一切都很好。我有很多数据要显示在网格中,因此每次加载数据时都会显示滚动条。拖动滚动条时,项呈示器无法正常工作,并且缺少少量数据列数据。我知道如何解决此问题。

在此处找到图片Image click

请检查以下代码: - `                           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>

`

1 个答案:

答案 0 :(得分:0)

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

查看Google搜索结果:

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.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=fc4777bf82d127e8&biw=1600&bih=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
        }