2010-10-25 4 views
0

J'ai un problème, j'utilise un AdvancedDataGrid.Délai d'exécution Flex dans AdvancedDataGrid

Il charge environ 3000 enregistrements avec environ 20 colonnes. Je reçois constamment le délai d'exécution Flex car la grille s'exécute beaucoup dans LayoutManager. Comment puis-je le rendre de façon asynchrone ou plus rapide du tout?

+0

Le Flex ADG et DG devrait facilement être en mesure de charger 3000 enregistrements. Cela ne devrait pas causer de délai d'expiration. Pouvez-vous poster votre code ou quelque chose qui peut être utilisé pour reproduire ce comportement? –

Répondre

0

Datagrid Utilisez la pagination.

http://gurufaction.blogspot.com/2007/02/flex-datagrid-paging-example-with.html http://stackoverflow.com/questions/1893350/how-does-flex-3-datagrid-paging-work

ou quelque chose comme ça

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="InitApp()" xmlns:MyComp="*"> 
<mx:Script> 
    <![CDATA[ 
     import mx.collections.ArrayCollection; 
     import mx.events.ItemClickEvent; 
     [Bindable] 
     public var myData:ArrayCollection = new ArrayCollection(); 
     public var orgData:ArrayCollection = new ArrayCollection(); 
     [Bindable] 
     public var nav:ArrayCollection = new ArrayCollection(); 
     private var index:int = 0; 
     private var page:int = 25;  
     private var paging:Boolean = true; 

     private function InitApp():void { 
      for(var x:uint = 1; x <= 500; x++) { 
       var obj:Object = new Object(); 
       obj.Id = x.toString(); 
       obj.Name = "Column " + x.toString(); 
       obj.Street = "5555 Street"; 
       obj.Title = "CEO"; 
       obj.City = "El Paso"; 
       orgData.addItem(obj); 
      } 
      refreshDataProvider(0); 
     } 

     private function navPage(d:int):void { 
      index += d; 
      refreshDataProvider(index); 
     } 

     private function refreshDataProvider(start:int):void { 
      if (paging == true) { 
       page = 25; 
       myData = new ArrayCollection(orgData.source.slice(start,start+page)); 
      } 
      else { 
      index = 0; 
       page = 500; 
       myData = new ArrayCollection(orgData.source);    
      } 
      down.enabled = index > 0; 
      up.enabled = index + page < orgData.length; 
      lbl.text = index.toString() + ' to ' + (index + page).toString() + ' of ' + orgData.length;    
     } 

     private function togglePaging():void { 
      paging = !paging; 
      toggle.label = paging.toString(); 
      refreshDataProvider(index); 
     } 

]]> 
</mx:Script> 
    <mx:DataGrid id="dg" dataProvider="{myData}" width="510" height="202"></mx:DataGrid> 
    <mx:Button x="10" y="210" label="&lt;" click="navPage(-25);" id="down"/> 
    <mx:Button x="216" y="210" label="&gt;" click="navPage(25);" id="up"/> 
    <mx:Label x="58" y="212" text="page" width="150" id="lbl"/> 
    <mx:Button x="264" y="210" label="true" id="toggle" click="togglePaging();"/> 

</mx:Application> 
0

Charger les données un morceau à la fois? Dites un peu plus que de nombreuses lignes sont montrées visuellement. De cette façon, vous obtenez la performance perçue qu'elle rend rapidement.

3000 dossiers est beaucoup à charger en une seule fois, il faut dire ...

Questions connexes