Forms with a high number of records take a significant time to show


You might have seen this before in the Dynamics AX 2009 Client, that if you open a transaction Form like CustTransOpen the very first row is displayed quickly, however all other rows of the Grid are shown after a significant time. In between the Dynamics AX 2009 Client is unresponsive (frozen).

The reason for this situation is the automatic sizing that happens for columns on the Grid. Actually this automatic sizing happens by default for all Grids however you only notice the negative effect when the DataSource contains a lot of records and / or some columns are filled by DataMethods.

This issue was first reported for the table browser, and for this also a fix was created that is included in the Rollup 2. The Kernel fix basically introduces the possibility to turn the automatic sizing off, by adding a new Kernel method autoSizeColumns to the Grid.

This fix alone does however not solve the issue on the individual Forms, because the automatic sizing is by default still turned on, so you need to manually disable automatic sizing on the affected Forms where you suffer from this feature.

To turn the automatic sizing of you first need to turn the property “AutoDeclaration” of the affected Grid to “Yes”. Then you can use the following X++ code for example in the Init method of the Form:

   …
   Grid.autoSizeColumns(false); 
   …

 

–author: Thomas Treen
–editor: Alexander Lachner
–date: 12/07/2010
Comments (1)

  1. Michael says:

    Hi,

    there is a second problem with autoSizeColumns:

    When you change the DiplayLength property of an EDT and any field of a table based on that EDT is specified on the DataField property of any grid control in a grid based form then on opening the form the changes does not apply as expected. Also when you

    change the DiplayLength property of that grid control in the same form ,  then on opening the form the changes does not apply as expected.

    Example:

    If you need more decimals for invenQty… salesQty displayLength is not enough for e.g. in salesLine.

    In previous versions of ax only change displaylength of an EDT and its ok in all Forms.

    In ax2009 through autoSizeColumns displaylength of an EDT dont work.

    Columnsize in salesLine is setting by the size of first showing records.

    Workaround here is to disable autoSizeColumns too (Grid.autoSizeColumns(false).

    Best regards

    Michael