The Issues Behind Grid and Fixed Controls in Dynamics 365 BC and How to Fix It

Ieva Vizgirdaitė

Developer

Topic: Technical

Date: 13 Aug 2020

Grid and Fixed controls in Dynamics 365 Business Central are used to arrange fields in rows and columns. By default fields, in pages are arranged automatically in two columns, but in some cases, you may want to arrange fields in a page unusually. For this, you will have to use a grid or fixed control. We recommend using Grid or Fixed controls only in cases where there are no other ways out. These controls aren’t recommended to use by Microsoft either. Using these controls code readability gets more complicated, the performance becomes slower.

As web client supports grid control only partially, there are a lot of unsupported features of grid control.  In this post, we will also discuss the issues that might arise if you are using a txt2al converter for pages that contain grid or fixed controls.

Let’s begin with the grid and fixed controls structure.

In the layout area, you have to set a group in which you can define grid or fixed control. If you define grid control, you can specify how you want to arrange fields by rows or columns using GridLayout Property. Using a Web Client, you can only arrange fields in columns also Business Central Web Client does not support row and column spanning for fields. When you have a control defined, you can then group fields into groups. Let’s look at example 1 with grid control, which has three groups of fields.

Example 1 code:

 

 

Example 1 output:

 

Now let’s change the control from the grid to fixed (the green line in example 1 code) and look at the differences in the second example.

Example 2 output:

 

As we see, the lines separating columns disappear. Captions are left only for rows and columns, not for each field. You can read more about differences in Microsoft documentation.

In RTC, when using Grid control, we mostly set property Layout to Rows. However, when converting a page using the txt2al tool, its visual representation doesn’t look how we want on the web, since Layout property is not supported in a web client. Let’s look at the examples and fixing possibilities.

Example 3. I have created a page in RTC with one gridlayout group in which there are a lot of smaller field groups.

Example 3 layout:

 

Example 3 output:

 

After transforming the page with the txt2al tool, our page structure looks like this (some properties have been deleted).

Example 3 code converted to AL:

 

Example 3 output in web:

 

A pretty quick fix if you want to keep row structure is to add grid control to every field group, basically to divide each line into columns – look at example 4.

Example 4 output:

 

Example 4 code:

 

 

Example 5. I have created a page in RTC with one gridlayout group (Layout = Rows), which contains only one group of fields.

Example 5 layout:

 

Example 5 output:

 

Example 5 after conversion to AL:

 

Example 5 code in AL:

 

To fix the view of the page in example 5 – I have added each field into a new group, and each field caption transferred to the group caption – check example 6.

Example 6 code:

 

Example 6 output:

 

To sum up, please check the layout of pages that have a grid and fixed controls, after converting them with the txt2al tool. It is vital because most probably, the layout will look not as expected, and refactoring may be required.

Related Posts
Read latest industry tips and news in our blog