cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create tree using code only without Tree entity?

SOLVED
Highlighted
Gravel

How to create tree using code only without Tree entity?

Hi All,

How to create tree using code only without Tree entity?

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to create tree using code only without Tree entity?

Hi Bhuwaneshwar Gupta​,

Change row.from = undefined;

row.from ="Root"

Root can be any value. We just need to add the same in the Tree widget -> RootParentId property.

I hope it helps.

View solution in original post

11 REPLIES 11
Highlighted

Re: How to create tree using code only without Tree entity?

Hi Bhuwaneshwar Gupta​,

As per my understanding tree widget is a nested infotable with Parent as String and child as infotable (  Datashape same as parent). So, you can try to code accordingly.

I hope it helps.

Highlighted

Re: How to create tree using code only without Tree entity?

Hi Ankit,

Can you share me  some chunk of code for this?

Highlighted

Re: How to create tree using code only without Tree entity?

Hi Bhuwaneshwar Gupta​,

Are you looking for the insert, delete functions in the Tree Infotable?

I don't have a sample code available for same.

Highlighted

Re: How to create tree using code only without Tree entity?

EntityNetwork Data Shape defines the structure of Network Tree.

Highlighted

Re: How to create tree using code only without Tree entity?

Hi Ankit,

I have  written service which return infotable. Now when I am showing on grid its value coming but when showing on tree its blank.

Service  ---

var params = {

  infoTableName : "InfoTable",

  dataShapeName : "FloserveTestNetwork"

};

var networkInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

var Name = "PlantArea1";

var row = new Object();

row.no = 1;

row.from = undefined;

row.to = Name;

row.description = Name;

row.connectionType = "Contains";

row.name = Name;

networkInfoTable.AddRow(row);

var row1 = new Object();

row1.no = 2;

row1.from = Name;

row1.to = "Asset1";

row1.description = "Asset1";

row1.connectionType = "Contains";

row1.name = "Asset1";

networkInfoTable.AddRow(row1);

var row2 = new Object();

row2.no = 3;

row2.from = Name;

row2.to = "Asset2";

row2.description = "Asset2";

row2.connectionType = "Contains";

row2.name = "Asset2";

networkInfoTable.AddRow(row2);

var row3 = new Object();

row3.no = 3;

row3.from = Name;

row3.to = "Asset3";

row3.description = "Asset3";

row3.connectionType = "Contains";

row3.name = "Asset3";

networkInfoTable.AddRow(row3);

var result = networkInfoTable;

Output

Highlighted

Re: How to create tree using code only without Tree entity?

Hi Bhuwaneshwar Gupta​,

Change row.from = undefined;

row.from ="Root"

Root can be any value. We just need to add the same in the Tree widget -> RootParentId property.

I hope it helps.

View solution in original post

Highlighted

Re: How to create tree using code only without Tree entity?

Hi Bhuwaneshwar Gupta​,

Please find attached entities I used.

Highlighted

Re: How to create tree using code only without Tree entity?

Thanks Ankit. It is working now

Highlighted

Re: How to create tree using code only without Tree entity?

hi,

 

I am using thingworx 8.1.0, and while importing it is giving an error. what version have you used?

Highlighted

Re: How to create tree using code only without Tree entity?

Hi, Thanks for the post. Now I'ld like to know how to create a nested tree.

Highlighted

Re: How to create tree using code only without Tree entity?

Hi Ankit,

Can you share me  some chunk of code for this?

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!