Forums

Forums / Developing Portals / Subgrid column ordering

Subgrid column ordering

2 posts, 1 answered
  1. Mike Cohen
    Mike Cohen avatar
    31 posts
    Registered:
    10 Aug 2021
    19 Jan 2022
    Link to this post
    We are using a subgrid with a large number of columns.  If I add a new column to the fetch XML, the most recently added column always appears on the far right had side of the column, regardless of where I insert the column into the list via fetch.   The only way I can dictate column order is to add the columns in the correct order of appearance , since I cannot rearrange their order after the fact. 

    I can have 2 fetchxml grids with the same fetch display the same grid with a different column order depending on chronologically when I added each individual column.  We are still mapping out our column layouts and so they are changing, but with this limitation I cannot rearrange columns without recreating the entire grid in fetch.  

    Is there any widget setting or otherwise to dictate horizontal column layout in the subgrids?  with close to 50 columns in some cases, javascript is not really a good option.
  2. Adam Benoit
    Adam Benoit avatar
    23 posts
    Registered:
    01 Mar 2017
    Answered
    20 Jan 2022 in reply to Mike Cohen
    Link to this post
    Hi Mike,

    The only other option would be to manually reorder the JSON data backing the columns tab in the designer. This option is NOT supported and it is quite possible to break something so be sure to keep the original, just in-case.

    In the designer of the sub-grid, click the 'Advanced' button, then the 'Model' button to open the model properties. In there, you will find a field labelled 'ColumnDefinitions'. This is where the setting from the Columns tab of the designer are stored as JSON data, including the column order. As the items in the data are stored in an array, the order of the array items is the order of the columns.

    The data is stored as a single line so to make it usable you will need to use something like Notepad++ or another editor that can format JSON . after rearranging the data, it will need to be flattened back to a single line in order to put it back in the designer field.

    Ultimately, the TPC grids work best with about 10 columns. Once you go past that, it becomes less usable for end users. Another option would be to use the ListView to create rows that contain all the same information but stacked to fit. For sorting and filtering of the ListView, JavaScript and Kendo controls can be used to create a this functionality above the ListView making sort and filter calls to the underlying datasource of the ListView.

    Hopefully this helps. Please let us know if you have any questions.
2 posts, 1 answered