Can I add columns to a relationship tab dynamically?

How do I add a column to a relationship tab dynamically.

I wish to federate an ItemType, the number of columns returned depends on the dataset and query combination and cannot be predicted prior to the query being run. Typically I would expect 30-40 columns, but could theoretically be up to 200.

My plan is to add a relationship type which is populated onGet, to bring back the required information using my Query.  I would not to create a custom relationship view, as this will ensure compatibility with future upgrades. 

What is the best way to proceed?

  • Can I create columns dynamically to return the results?
  • Do I create a related ItemType with 200 columns and hide the ones I'm not using with JavaScript?

Any help is appreciated.

Many thanks,
Martin.

  • Hi Meismart,

    I do not know a solution, but I am also interested in this use case. But I don´t think this one is easy to solve. Some ideas:

    1. Dynmically show/hide columns

    I think this is possible, but I am not sure if it will also work for federated content. The property selector in the grid does something similar. I assume the corresponding file is 'columnsSelection.js' in the codetree. 

    When you have the max amount of columns (200), do they include the same columns as used for the other use cases? When all properties are included in your ItemType, it´s maybe possible to use some kind of filter matrix to select which kind of columns you want to show/hide.

    2. Create columns dynamically.

    I wonder if it´s possible to create an ItemType which dynamically generated federated properties. Probably not a good idea.
    But do you really need the standard grid? Or are also other view options sufficient? Maybe it´s possible to use a standard Form in the relationships that renders a custom grid. An example for a custom grid rendering can be found in this project: https://github.com/ArasLabs/my-recent-items

  • Hi Angelalp,

    I think the functionality I want exists in Client\javascript\item_window.js which refers to ItemsGrid

    Looking in \Client\javascript\ItemsGrid there seems to be 3 files:
    MainGridFactory.js defines which scripts to use for each ItemType - I think I want to create an Overload for my custom ItemType

    BaseItemTypeGrid.js calls:
     visiblePropNds = aras.getvisiblePropsForItemType(currItemType);
     aras.uiInitItemsGridSetups(currItemType, visiblePropNds);

    By creating my customItemTypegrid.js I believe I could populate the visiblePropNds with my custom nodes.

    I have not yet found how getvisiblePropsForItemType or uiInitItemsGridSetups works, but that is where I plan to look next. uiInitItemsGridSetups takes the ItemType as an argument, so this too may need modification to work.

    I'm not great at JavaScript, so I haven't tried modifying anything yet.

    Many thanks,
    Martin.

  • Hello,

    The getVisiblePropsForItemType function will return the properties on an ItemType that have is_hidden set to True.

    I'm less familiar with the uiInitItemsGridSetups function, but I believe it checks to make sure that the column order and column widths in the current user's Preferences are valid. These Preferences are used to reload the order and width of the columns that a user had set the last time they viewed the grid.

    Chris

    Christopher Gillis

    Aras Labs Software Engineer