salut,
j'ai une advancedDataGrid avec 7 colonnes de text et une colonne contenant des icones de 3k. Quand je charge une page d'une centaine de rows, les icones prennent énormément de temps pour s'afficher.
Y-a-t-il moyen d'accélérer l'affichage?
Merci
Voici le code :
- le mxml :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="init()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import com.test.Purchase;
import mx.controls.Alert;
 
 
[Bindable]
public var modified:Boolean=false;
 
 
[Bindable]
public var myAC:ArrayCollection = new ArrayCollection();
public function init() :void {
	var aPurchase:Purchase=new Purchase();
	var anotherPurchase:Purchase= new Purchase();
	aPurchase.id=120;
	aPurchase.category="category1";
	aPurchase.name="advantage 2";
	aPurchase.icon="..\\assets\\coeur_rouge.png";
 
	myAC.addItem(aPurchase);
 
	anotherPurchase.id=220;
	anotherPurchase.category="category2";
	anotherPurchase.name="Nintendo DS";
	anotherPurchase.icon="..\\assets\\coeur_gris.png";
	myAC.addItem(anotherPurchase);
}
 
 
 
]]>
</mx:Script>
 
 
<mx:AdvancedDataGrid id="dg" width="500" height="150" dataProvider="{myAC}">
<mx:groupedColumns>
<mx:AdvancedDataGridColumn dataField="id"   headerText="ID" width="300" />
<mx:AdvancedDataGridColumn dataField="category"   headerText="Category" width="400" />
<mx:AdvancedDataGridColumn dataField="name"   headerText="Name" width="400" />
<mx:AdvancedDataGridColumn headerText="favorite" width="400">     
	<mx:itemRenderer>         
	<mx:Component>   
	<mx:Image source="{data.icon}" width="60"/>
	</mx:Component>
 
	</mx:itemRenderer>
</mx:AdvancedDataGridColumn>
</mx:groupedColumns>
</mx:AdvancedDataGrid>
</mx:Application>
- la classe entité

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
package com.test
{
	public class Purchase
	{
	 public function Purchase() { }
        private var _id:int = -1;
        private var _category:String = null;
        private var _productName:String = null;               
        private var _icon:String=null;
 
        public function get icon():String {
        	return _icon;
        }
 
        public function set icon(anIcon:String):void {        
        	_icon=anIcon;
        }
 
 
        public function get id():int {
            return _id;
        }
 
        public function set id(pId:int):void {
            _id = pId;
        }
 
 
        public function get category():String {
            return _category;
        }
 
        public function set category(pCategory:String):void {
            _category = pCategory;
 
            if ((_category == null) || (_category == "")) {               
                _category = "Default Category";
            }
        }
 
        public function get name():String {
            return _productName;
        }
 
        public function set name(pName:String):void {
            _productName = pName;
 
            if ((_productName == null) || (_productName == "")) {
                _productName = "default product name";
                category = _productName;
 
            }
        }
 
	}
}