Flex AdvancedDataGrid 子节点渲染器展开式混乱问题

上次写道在Flex AdvancedDataGrid中使用树形结构,并且为父节点和多个子节点分别制定渲染器。

 

现在出现问题:

 

 第一次渲染显示正确,当父节点存在多个子节点并且我们为每个子节点指定渲染器,当再次单击父节点展开子节点时子节点渲染器乱序或者是和我们预期的显示不符合?

 

 

解决方案:

 

监听AdvancedDataGrid的AdvancedDataGridEvent.ITEM_OPEN事件,当展开子节点时重新为其指定渲染器

 

 

//_allot.bills为AdvancedDataGrid


_allot.bills.addEventListener(AdvancedDataGridEvent.ITEM_OPEN,open);


public function open(e:AdvancedDataGridEvent):void
		{
			
			var drps:AdvancedDataGridRendererProvider = new  AdvancedDataGridRendererProvider;
			var drpsw:AdvancedDataGridRendererProvider = new AdvancedDataGridRendererProvider;
			var drpc:AdvancedDataGridRendererProvider = new AdvancedDataGridRendererProvider;
			var drpdw:AdvancedDataGridRendererProvider = new AdvancedDataGridRendererProvider;
			var drpps:AdvancedDataGridRendererProvider = new AdvancedDataGridRendererProvider;
			
			drps.depth = 2;
			drps.column = _allot.status;
			drps.renderer = new ClassFactory(CommonStatusRender);
			
			drpsw.depth = 2;
			drpsw.column = _allot.sourceWareHouse;
			drpsw.renderer = new ClassFactory(CommonSourceWareHouseRender);
			
			drpdw.depth = 2;
			drpdw.column = _allot.destWareHouse;
			drpdw.renderer = new ClassFactory(CommonDestWareHouseRender);
			
			drpc.depth = 2;
			drpc.column = _allot.code;
			drpc.renderer = new ClassFactory(CommonCodeRender);
			
			drpps.depth = 1;
			drpps.column = _allot.status;
			drpps.renderer = new ClassFactory(CommonParentStatusRender);
			
			_allot.bills.rendererProviders = [drps,drpsw,drpdw,drpc,drpps];
			
			_allot.bills.invalidateList();
			
		}
 
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页