Показать сообщение отдельно
Старый 13.09.2017, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
sunilrakesh: Tree structure on a custom form  D365 Ops
Источник: https://community.dynamics.com/membe...f-ed7d20fadbd4
==============

Today I came across to develop tree structure like parent asset having multiple child assets... for an custom form same like Asset form ->structure tab. For this follow below steps to achieve.
1. Create new class.
// This is a framework class. Customizing this class may cause problems with future upgrades to the software.
public class ImageListAppl_Unit extends ImageListAppl

{
void build()
{
super();
this.add(#ImageItem);
this.add(#ImageBOM);
}
}




<div class="paragraph" style="text-align:left;">void createStruct()

{

FormTreeItem formTreeStructure; 
imageListAppl = new ImageListAppl_Unit();

structure.setImagelist(imageListAppl.imageList());

select assetTable where assetTable.ProjId == UnitTable.ProjId;

assetIdTop = assetTable.topMainAsset();

// This is not a threat because it is only adding additional asset numbers to the tree.
// BP Deviation Documented
formTreeStructure = new FormTreeItem(assetIdTop, imageListAppl.image(AssetTable::treeImage(assetIdTop)),-1,assetIdTop);
structure.delete(structure.getRoot());
this.buildComposedOf(assetIdTop,structure.addItem(0,FormTreeAdd::Sort,formTreeStructure));

buildStructure = false;
}
void buildComposedOf(AssetId _assetId,
int _treeHeader,
NoYes _list = NoYes::No)
{
FormTreeItem formTreeItem;
container childList;
AssetId childAssetId;
Counter childListLength;
Counter childIdx;

int node;

imageListAppl = new ImageListAppl_Unit();

structure.setImagelist(imageListAppl.imageList());
 
if (!_assetId)
{
return;
}


childList = AssetTable::childList(_assetId);
childListLength = conLen(childList);


for (childIdx = 1; childIdx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.