Is there a lightweight way to display Tree-Grid-Data in Forms?

Hi community,

I am playing around with displaying some data structure as Tree-Grid-View in Forms. The amount of data is very small.

Normally we can display Tree-Grid-View data in relationships or pop-up dialogs. But I don´t want that users have to click around every time they need to see the data. It´s data that´s useful for daily work, so it would be super useful when it´s directly accessible within the Form.

I discovered that it is possible to display Tree-Grid-Views in Forms. But from my POV the regular TGV layout is a little bit too heavy for my use case. I only want to display a small amount of data (only one data column, not much levels). Basically I just need the TGV data, no toolbar, no headers, no actions. Just a simple view to the data.

Does anyone now a more lightweight rendering variants for TGVs?

Thanks for any input!

Angela

Parents
  • Tree are my nemesis in 2022.

    TGV in Forms is not super hard to do. You use a html element that carries an empty iframe. Then use the standard Method produced by TGV but connect the TGV to the iframe instead of populating a pop-up dialog. I remember there is even some sample on Github (was a question by another user somewhere).

    But no: I so far didn´t succeed to make it lightweight without the toolbar and stuff.

    In general I am constantly looking for easy to use solutions to build custom trees.


    The shown approach by alaxala would be perfect, if AML would return us the levels. Which lead to this unsolved question:
    https://community.aras.com/f/development/37188/how-to-get-level-depth-of-items-returned-from-an-getitemrepeatconfig-aml-query

    Other tree design are supported by Aras, but they all require much investigations:
    https://community.aras.com/f/development/36981/tgvgrids-vs-treegridviews---what-is-the-difference-and-which-one-is-intended-to-be-used

    It would be cool if we could add more custom elements in the tgv...
    https://community.aras.com/f/development/5565/tree-grid-view-tgv-how-i-can-render-a-cell-as-an-icon-image

    The tree I work on right now required a lot of custom elements like images, input fields, button, links, etc. . In this case I ended up using an external jquery library for rendering the tree. In my case the data was federated from another database via SQL. So in this case was able to do the level calculation with SQL. But I would be happy to know an easy way to do it without SQL. Aras TGVs calculate levels, but the used code is very inflexible in the moment.

    So I hope you now have get some inspiration about trees in the Forms. I anyone knows even more variants please let me know Smiley



  •  thanks for the pointer!  After some digging I found this thread:  tree-view-in-main-grid

    That got me in the right direction, but running into an issue of the method is blankly dumping the TGV into the form, not into the HTML container designated.  I assume I'm missing something to grab the ID of the container or need to change out the document.createElement...?  I've named the HTML container on the form as "tree_grid_viewer", but doesn't seem to work.  The method is set to run onFormPopulated against the Form Body.

    Any help would be appreciated!

    // eslint-disable-next-line
    // @ts-nocheck
    var topWindow = aras.getMostTopWindowWithAras(window);
    var tgvdIdParam;
    var startConditionProviderParam;
    var parametersProviderParam;
    
    tgvdIdParam = 'tgvdId=60354DB4DEA04643818D20290DC967DC';
    startConditionProviderParam = 'startConditionProvider=ItemDefault({"id":"id"})';
    
    var tgvUrl = aras.getBaseURL(
    	'/Modules/aras.innovator.TreeGridView/Views/MainPage.html?'
    );
    var allParams = [
    	tgvdIdParam,
    	startConditionProviderParam,
    	parametersProviderParam
    ];
    for (var i = 0; i < allParams.length; i++) {
    	if (allParams[i]) {
    		tgvUrl += (i === 0 ? '' : '&') + allParams[i];
    	}
    }
    
    var iframe = document.createElement('iframe');
    iframe.id = 'tree_grid_viewer';
    iframe.width = '50%';
    iframe.height = '50%';
    iframe.position = 'absolute';
    iframe.top = '190px';
    iframe.left = '167px';
    iframe.frameBorder = '0';
    iframe.scrolling = 'auto';
    iframe.src = tgvUrl;
    document.body.insertBefore(iframe, document.body.childNodes[0]);

  • "the method is blankly dumping the TGV into the form, not into the HTML container designated."

    Yeeees...cause this is what your code does right now. It creates a NEW iframe and dumps the TGV straight into the form with document.body.insertBefore.

    Why not do something like this:

    var iframe = document.getElementById("bplTgvFrame");
    ...
    iframe.src = tgvUrl;

     I should start to write consulting invoices....!Grinning

    Unfortunately we lost user Alaxala in this threat due to the spam filter. Alaxala showed me another useful approach, but weren´t able to test it yet.

Reply
  • "the method is blankly dumping the TGV into the form, not into the HTML container designated."

    Yeeees...cause this is what your code does right now. It creates a NEW iframe and dumps the TGV straight into the form with document.body.insertBefore.

    Why not do something like this:

    var iframe = document.getElementById("bplTgvFrame");
    ...
    iframe.src = tgvUrl;

     I should start to write consulting invoices....!Grinning

    Unfortunately we lost user Alaxala in this threat due to the spam filter. Alaxala showed me another useful approach, but weren´t able to test it yet.

Children
No Data