How to display selfreferring data

2
Hi all, I'm trying to implement a selfreferencing data structure, but I'm stuck on displaying the data. Above picture shows a snippet containing a listview which again contains the outer snippet   How can I work around this without knowing the depth of the data beforehand?
asked
2 answers
6

Implement recursion with an HTMLSnippet. Create a page as above with a data/template grid with the appropriate retrieve and set the snippet code to check for context not null and if so use mx.ui.openForm to load the same page.

Rough cut:

this._rendered=typeof(this._rendered)=='undefined'?false:this._rendered;
if(this.contextObj!=null&&!this._rendered){
                this._rendered=true;
	mx.ui.openForm("Anonymous/pop_comment.page.xml", {
		location: "node",
		domNode:this.domNode,
		context:this.mxcontext,
		callback: function(form) {
			console.log(form.id);
		}
	});	
}else{
}

Setup:



Alternatively create a widget.

Write a recursive function using mx.data.get to retrieve recursively via xpath or path . Whilst recursing, create dom nodes and while doing so use mx.ui.openForm  to place it in these nodes with  domNode set to the widget’s domnode,  context  set to the associated object

answered
1

To my knowledge, it is not possible to make a recursive path in pages.

I'm trying to tackle this same problem myself, and I'm trying to accomplish this by using (one of) the following add-on widgets:

https://appstore.home.mendix.com/link/app/294/Mendix/TreeView-and-GridView

https://appstore.home.mendix.com/link/app/112707/Mendix/Tree-View

Perhaps one of these widgets might also help you?

answered